对Amazon的Alexa技能套件(ASK)Lambda交互进行故障排除 [英] Troubleshooting Amazon's Alexa Skill Kit (ASK) Lambda interaction

查看:145
本文介绍了对Amazon的Alexa技能套件(ASK)Lambda交互进行故障排除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从ASK开发开始。我对某些行为感到有些困惑,我想知道如何从服务模拟器控制台中调试错误。如何获得有关无法调用远程端点或返回的响应无效的信息。错误?

I'm starting with ASK development. I'm a little confused by some behavior and I would like to know how to debug errors from the "service simulator" console. How can I get more information on the The remote endpoint could not be called, or the response it returned was invalid. errors?

这是我的情况:

我有一个技能和三个Lambda函数(ARN:A,ARN:B,ARN:C)。如果将技能的端点设置为ARN:A并尝试从技能的服务模拟器对其进行测试,则会收到错误响应:无法调用远程端点,或者它返回的响应无效。 / code>
我复制了lambda请求,前往ARN:A的lambda控制台,我甚至设置了测试,粘贴了服务模拟器中的请求,进行了测试,我得到了一个很好的结果询问响应。然后,转到ARN:B的Lambda控制台,并创建一个虚拟处理程序,该处理程序返回与ARN:A从控制台给我的响应完全相同的响应(从字面上复制和粘贴)。我将技能的终结点设置为ARN:B,使用服务模拟器对其进行了测试,并且得到了预期的响应(因此,响应格式正确),尽管它是静态的。我再次进入lambda控制台,并将代码从ARN:A复制并粘贴到新的ARN:C中。将技能的端点设置为ARN:C即可正常工作。 ARN:C的问题在于它没有适当的权限将数据持久保存到DynamoDB中(我仍然对系统熟悉,不确定我是否可以在不同的lambda之间共享IAM角色,我相信不是)。
如何知道ARN:A的情况?那是记录在某处吗?我无法在cloudwatch /日志中找到与此特定Lambda或该技能相关的任何条目。

I have a skill and three Lambda functions (ARN:A, ARN:B, ARN:C). If I set the skill's endpoint to ARN:A and try to test it from the skill's service simulator, I get an error response: The remote endpoint could not be called, or the response it returned was invalid. I copy the lambda request, I head to the lambda console for ARN:A, I set the test even, paste the request from the service simulator, I test it and I get a perfectly fine ASK response. Then I head to the lambda console for ARN:B and I make a dummy handler that returns exactly the same response that ARN:A gave me from the console (literally copy and paste). I set my skill's endpoint to ARN:B, test it using the service simulator and I get the anticipated response (therefore, the response is well formatted) albeit static. I head to the lambda console again and copy and paste the code from ARN:A into a new ARN:C. Set the skill's endpoint to ARN:C and it works perfectly fine. Problem with ARN:C is that it doesn't have the proper permissions to persist data into DynamoDB (I'm still getting familiar with the system, not sure wether I can share an IAM role between different lambdas, I believe not). How can I figure out what's going on with ARN:A? Is that logged somewhere? I can't find any entry in cloudwatch/logs related to this particular lambda or for the skill.

不确定是否相关,我在lambda运行时使用python ,代码(现在)在Web编辑器上是内联的,并且我正在使用boto3保留到DynamoDB。

Not sure if relevant, I'm using python for my lambda runtime, the code is (for now) inline on the web editor and I'm using boto3 for persisting to DynamoDB.

推荐答案

tl ; dr:无法调用远程端点,或者它返回的响应无效。也意味着可能有一个超时在等待端点。

tl;dr: The remote endpoint could not be called, or the response it returned was invalid. also means there may have been a timeout waiting for the endpoint.

我能够将其范围缩小到超时。
好​​像Alexa服务模拟器(以及Alexa本身)比lambda测试控制台更不适应长时间响应。在开发过程中,我将ARN的超时时间从1秒增加到30秒(而我认为默认值为3秒)。 ARN:1使用的DynamoDB表的数据更多,并且处理时间比ARN:3的表几乎是空的,处理时间略长。当我注释掉一些数据加载内容后,它的运行速度略有提高,Alexa服务模拟器再次运行。我找不到任何地方记录的时间预算,大概是3秒?我很可能需要转移到另一个后端,lambda上的DynamoDB + Python对于非常琐碎的请求来说太慢了。

I was able to narrow it down to a timeout. Seems like the Alexa service simulator (and the Alexa itself) is less tolerant to long responses than the lambda testing console. During development I had increased the timeout of ARN:1 to 30 seconds (whereas I believe the default is 3 seconds). The DynamoDB table used by ARN:1 has more data and it takes slightly longer to process than ARN:3 which has an almost empty table. As soon as I commented out some of the data loading stuff it was running slightly faster and the Alexa service simulator was working again. I can't find the time budget documented anywhere, I'm guessing 3 seconds? I most likely need to move to another backend, DynamoDB+Python on lambda is too slow for very trivial requests.

这篇关于对Amazon的Alexa技能套件(ASK)Lambda交互进行故障排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆