Aws lambda &引用;errorMessage";:&引用;“未定义事件”;在lambda函数中
我正在创建我的第一个Alexa技能,它从dynamodb表中获取数据。我对node.js和alexa都很幼稚。我成功地创建了一个示例空间极客技能集,然后当我创建自己的技能集时,我使用了相同的包(以确保库、响应文件保持不变),但只更改了index.js(这是我的lambda功能)。在lambda console上测试此函数时,出现以下错误:Aws lambda &引用;errorMessage";:&引用;“未定义事件”;在lambda函数中,aws-lambda,alexa,alexa-skills-kit,alexa-skill,Aws Lambda,Alexa,Alexa Skills Kit,Alexa Skill,我正在创建我的第一个Alexa技能,它从dynamodb表中获取数据。我对node.js和alexa都很幼稚。我成功地创建了一个示例空间极客技能集,然后当我创建自己的技能集时,我使用了相同的包(以确保库、响应文件保持不变),但只更改了index.js(这是我的lambda功能)。在lambda console上测试此函数时,出现以下错误: { "errorMessage": "event is not defined", "errorType": "ReferenceError",
{
"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)"
]
}
该函数在不使用alexa的情况下可以正常工作。现在我无法调试该问题。我从alexa技能测试中测试了这个,然后得到以下错误:
{
"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)"
]
}
无法调用远程终结点,或者它返回的响应无效
我的文件夹结构是:
-节点单元
-index.js
-模板yaml
非常感谢任何指针。在
index.js
中,您应该有一个参数中带有事件的函数,即使您不使用它:
exports.handler=(事件、上下文、回调)=>{[…]}代码>您是否在代码中的某个地方引用了事件
?没有看到代码,它看起来是这样的。我假设在Lambda中,您试图引用事件
从Alexa获取有效负载,但听起来您做得不正确。您可以发布代码吗?