I am attempting to list an S3 bucket from within my node.js (8.10) lambda function.
When I run the function below (in Lambda), I see "Checkpoint 1" and "Checkpoint 2" in my logs, but I don't see any logging from the listObjectsV2 call, neither error nor data. My timeout is set to 10 seconds and I am not seeing any log entries for timeouts, either. I think I may missing something about using asynchronous functions in lambda?
const AWS = require('aws-sdk');
const s3 = new AWS.S3({apiVersion: '2006-03-01'});
exports.handler = async (event, context) => {
// console.log('Received event:', JSON.stringify(event, null, 2));
var params = {
Bucket: 'bucket-name'
}
console.log("Checkpoint 1");
s3.listObjectsV2(params, function (err, data) {
if (err) {
console.log(err, err.stack);
} else {
console.log(data);
}
});
console.log("Checkpoint 2");
};
Can someone point me in the right direction for finding my error here?