本文介绍了“ errorMessage”:“未定义事件”。在lambda函数中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建我的第一个Alexa技能,该技能可以从dynamodb表中获取数据。我对node.js和alexa都很幼稚。我成功地创建了一个示例Space geek技能集,然后在创建自己的技能集时,我使用了相同的程序包(以确保库,响应文件保持不变),但只更改了index.js(我的lambda函数)。在lambda控制台上测试此功能时,出现以下错误:

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)"
  ]
}

此功能过去无需使用Alexa即可完美运行。现在,我无法调试问题。我从alexa技能测试中对此进行了测试,然后收到以下错误:

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:

无法调用远程端点或返回的响应无效

我的文件夹结构是:

-Node_Modules

-Node_Modules

-index.js

-index.js

-template.yaml

-template.yaml

任何指针都受到高度赞赏。

Any pointers are highly appreciated.

推荐答案

在您的 index.js 中,您应该有一个带有的函数。事件作为参数,即使您不使用它:

In your index.js, you should have a function with event in argument, even if you don't use it :

exports.handler =(事件,上下文,回调)=> {[...]};

这篇关于“ errorMessage”:“未定义事件”。在lambda函数中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 10:08