I created a NodeJS Lambda function with Serverless. It reads from a DynamoDB table and writes the data to a S3 bucket.
Here\'s my handler.js
: (showing the af
Your outer promise is finishing without waiting the writeToBuffer
promise.
Try changing:
workbook.writeToBuffer().then(...
To:
return workbook.writeToBuffer().then(...
You should do the same to the S3 upload call:
return S3.upload(params).promise().then(data => {
callback(null, response(200, res));
});
I would also recommend you rewrite your code using the async
/ await
syntax, so it is easier to read and understand.