Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
Async function returning Promise after await

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;
};
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!