The following code:
async function addData() {
console.log("Adding a new record");
var ddb = new AWS.DynamoDB({ apiVersion: '2012-08-10' });
var params = {
TableName: 'mytable-xxx',
Item: {
'name': { S: 'xxx },
'vendor': { S: 'yy'}
}
};
// Call DynamoDB to add the item to the table
await ddb.putItem(params, function (err, data) {
if (err) {
console.log("addData Error", err);
} else {
console.log("addData Success", data);
}
});
console.log("Finishing adding a new record");
}
And as a result i do get output:
Adding a new record
Finishing adding a new record
Why await did not work ? This i AWS Lambda execution.
Thanks,