const AWS = require('aws-sdk');
const dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'});
exports.handler = async (event) => {
var note = {};
note.noteid = new Date().getTime();
note.content = event.queryStringParameters["content"];
var res = {};
const response = {
statusCode: 200,
body: JSON.stringify(note),
};
var obj = {
'TableName':'notes',
'Item': {
'note_id': {
S: '2'
},
'name': {
S: 'content'
}
},
'ReturnConsumedCapacity': "TOTAL"
};
dynamodb.putItem(obj, function(err,result){
console.log('function called!!');
console.log(err);
return response;
});
};
My putItem is not working, the callback function is not being called. I have given full access to role of this user, but still function is not getting called.