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

152
Vistas
Can't resolve promise returned by Immediately Invoked Async Arrow Function

I'm trying to assign a variable to an immediately invoked async function but cannot resolve the promise it returns.

const user: any = (async () => {
        try {
            return JSON.parse(await redis.get(email) || '{}')
        } catch (error) {
            console.log('Failed to parse JSON of redis value, error:', error)
            return {}
        }
    })().then(token => {return token})

console.log(user) prints Promise { <pending> }, I've read all the answers on here related to this subject and can't figure out how to make this work, if it's even possible/ advisable. Thanks.

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