My async function below is always returning a Promise instead of waiting to resolve. I'm fairly new to async function and could use some help figuring out whats going on. I had to obfuscate the names of some functions and data in the function.
const getWebId = async (num) => {
const startTime = Date.now();
const args = {
request: {
num,
},
};
let response;
try {
const soapClient = await createClient();
response = await soapClient.<SOAP CALL HERE>(args);
if (!response[0]?.webid) {
throw new Error('Could not return a web ID');
}
} catch (error) {
console.log({ message: 'Error making service call: ', error: error.message });
return Promise.reject(error);
}
console.log({ message: 'Time to call service', callTime: Date.now() - startTime });
return response[0].webid;
};