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

145
Vistas
How to get the promise value inside an object?

I have my code like this, and I want to get the value of a promise and set it to one of my object keys.

   const defaultConfig = {
    s3: {
        region: process.env.ENV_S3_REGION,
        accessKeyId: juice.string('S3.ACCESS_KEY_ID', juice.MANDATORY), //THIS RETURNS A PROMISE
        secretAccessKey: process.env.ENV_S3_SECRET_ACCESS_KEY
    },
    uploadConfig: { 
        bucket: process.env.ENV_UPLOAD_BUCKET
    }
};

Normally I'd use async await for that on my other parts of my code, but if I intend to put value of it inside an object, how would you suggest I do that? Because that current code will just return me the value Promise(pending). Even if I place it inside the object like this,

s3: {
    region: process.env.ENV_S3_REGION,
    accessKeyId: async()=> await juice.string('S3.ACCESS_KEY_ID', juice.MANDATORY), //This returns a promise
    secretAccessKey: process.env.ENV_S3_SECRET_ACCESS_KEY
}

I'd still get the same promise pending message or returns back the value as function. I cannot get the actual string value which is a secret key.

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