Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda