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

150
Views
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
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!