Trying to read a dynamoDB table from Alexa Intent , when i execute following block of code getItem() method is being skipped
function alexaIntent(intent, session, callback) {
var results = "";
var params = {
Key: {
"name": {
S: "aaa"
}
},
TableName: "bbb"
};
console.log('1111111111111111111111111111111');
/* Code from here till.....*/
ddb.getItem(params, (err, data) => {
console.log('inside');
if (err) {
console.error("Unable to read item. Error JSON:", JSON.stringify(err, null, 2));
} else {
console.log("GetItem succeeded:", JSON.stringify(data, null, 2));
}
});
/* .....here is being skipped */
console.log('2222222');
callback(session.attributes,
buildSpeechletResponseWithoutCard("I am the King!!", "", "true"));
}
I am new to asynchronous programming , is there a basic concept / understanding I am missing ?
Output I am getting is :
1111111111111111111111111111111
2222222