I am new to aws and serverless .I don't know why i get undefined in the variable called - first: When i execute the function the command
sls invoke local -f hello -d '{"first":2}'
The object
{
"first":2
}
is send to the serverless function.And it is in the response in the event property. Why when i try to get the value of event.first i get undefined?
'use strict'
module.exports.hello = (event, context, callback) => {
const first = event.first;
console.log("**", first);
const response = {
statusCode: 200,
body: JSON.stringify({
event: event
}),
};
callback(null, response);
}
When i try event,first i need to get only the number in this case 2,but i get undefined