问题
I am creating my first Alexa skill which fetches data from dynamodb table. I am naive in node.js and alexa both. I was successfully able to create a sample Space geek skill set , and then when I created my own skill set I used the same package( to make sure the libraries, response files remain the same) but only changed the index.js ( which is my lambda funnction). When I am testing this function on lambda console , I am getting the below error:
{
"errorMessage": "event is not defined",
"errorType": "ReferenceError",
"stackTrace": [
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)"
]
}
This function used to work perfectly fine without using alexa. Now I am not able to debug the issue. I tested this from alexa skill testing then got the below error:
The remote endpoint could not be called or response it returned was invalid
My folder structure is:
-Node_Modules
-index.js
-template.yaml
Any pointers are highly appreciated.
回答1:
In your index.js
, you should have a function with event
in argument, even if you don't use it :
exports.handler = (event, context, callback) => { [...] };
来源:https://stackoverflow.com/questions/43030178/errormessage-event-is-not-defined-in-lambda-function