Now, let's learn a little bit more about programming Lambda functions with Node.js. We are going to take a closer look at the function handler, and in particular its arguments, that is:
- Event objects
- Context objects
- Callback objects
Open the handler.js file and delete the code that's in the function body. One way to learn about the event and context object would be to log them out on the console:
'use strict';module.exports.hello = (event, context, callback) => { console.log('event is', event);};
Let's see what this gives us.
I am invoking the function locally to see what the output is with the function name set as hello:
sls invoke local -f helloevent is
Ok, my event, apparently, is null. Let's ...