I'm getting started trying to write a lambda function with node and puppeteer. I'm using the serverless framework.
In my handler.js:
exports.detail = async (event, context) => {
console.log(event);
let id = event.pathParameters.id || 1;
console.log(id);
I've been trying to pass in an id parameter with the event parameter, but if its not set I want the value to be set to 1 . But when I try:
$ sls invoke local -f detail
{
"errorMessage": "Cannot read property 'id' of undefined",
"errorType": "TypeError",
"stackTrace": [
"TypeError: Cannot read property 'id' of undefined",
How can I get this working?