我从 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 并尝试从技能的服务模拟器对其进行测试,我会收到错误响应:无法调用远程端点,或者它返回的响应无效.
我复制了 lambda 请求,我前往 ARN:A 的 lambda 控制台,我设置了测试,粘贴来自服务模拟器的请求,我对其进行测试,我得到了一个非常好的 ASK 响应.然后我前往 ARN:B 的 lambda 控制台并创建一个虚拟处理程序,它返回与 ARN:A 从控制台给我的完全相同的响应(字面意思是复制和粘贴).我将技能的端点设置为 ARN:B,使用服务模拟器对其进行测试,我得到了预期的响应(因此,响应的格式很好),尽管是静态的.我再次前往 lambda 控制台,将代码从 ARN:A 复制并粘贴到新的 ARN:C 中.将技能的端点设置为 ARN:C,它工作得非常好.ARN:C 的问题在于它没有将数据持久保存到 DynamoDB 中的适当权限(我仍然对系统很熟悉,不确定我是否可以在不同的 lambda 之间共享一个 IAM 角色,我相信不会).我怎样才能弄清楚 ARN:A 发生了什么?那是在某处记录的吗?我在 cloudwatch/logs 中找不到与此特定 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.
不确定是否相关,我将 python 用于我的 lambda 运行时,代码(目前)内联在网络编辑器中,我使用 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 使用的数据更多,处理时间略长,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 Skill Kit (ASK) Lambda 交互故障排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!