“errorMessage”: “event is not defined” in lambda function

廉价感情. 提交于 2019-12-12 02:27:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!