Home > Software engineering >  await s3.getObject(params) returns object, but adding .promise() does not
await s3.getObject(params) returns object, but adding .promise() does not

Time:04-05

I am trying to simply pull an image from an S3 bucket inside of an aws-lambda script that I wrote in Node.

From all the examples I see, people do:

const params = {
  Bucket: event.bucket,
  Key: event.prefix,
};


console.log('Calling getObject'); // This gets hit
const data = (await (s3.getObject(params).promise())).Body.toString('utf-8')
console.log({ data }); // This NEVER gets hit            
  • Related