Alexa 技能向技能发送请求时发生异常
Alexa Skill An exception occurred while dispatching the request to the skill
首先,如果我在 alexa 应用程序开发页面上使用模拟器,一切正常,尽管请求看起来有些不同。如果我对我的 Alexa 设备说 "Ask appName {x} and {y}",那么我的 Web 服务会被调用并显示一条错误消息 "An exception occurred while dispatching the request to the skill"。 {X} 和 {Y} 是我的意图槽。
只有当直接与 Alexa 对话并且模拟器再次完美运行时才会发生这种情况。
以下是我与 Amazon Echo 对话时收到的请求。
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.6a13f2db-a9f6-43a9-bc4d-x063b86905b6c",
"application": {
"applicationId": "amzn1.ask.skill.ef8bd603-cc39-406e-bed8-a8f9xc94abba2"
},
"user": {
"userId": "xxx"
}
},
"context": {
"AudioPlayer": {
"playerActivity": "STOPPED"
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.ef8bd603-cc39-406e-bed8-a8f9c94abba2"
},
"user": {
"userId": "xxxx"
},
"device": {
"deviceId": "xx",
"supportedInterfaces": {
"AudioPlayer": {}
}
},
"apiEndpoint": "https://api.eu.amazonalexa.com",
"apiAccessToken": "xxxx"
}
},
"request": {
"type": "SessionEndedRequest",
"requestId": "amzn1.echo-api.request.2a993410-e7a8-4f37-87d7-a5063ef185b5",
"timestamp": "2017-12-22T00:11:45Z",
"locale": "en-GB",
"reason": "ERROR",
"error": {
"type": "INVALID_RESPONSE",
"message": "An exception occurred while dispatching the request to the skill."
}
}
}
下面是我的意图架构
{
"intents": [
{
"intent": "StartGameIntent"
},
{
"slots": [
{
"name": "playerOne",
"type": "AMAZON.US_FIRST_NAME"
},
{
"name": "playerTwo",
"type": "AMAZON.US_FIRST_NAME"
}
],
"intent": "PlayTheGame"
},
{
"intent": "StopTheGame"
},
{
"slots": [
{
"name": "damage",
"type": "AMAZON.NUMBER"
},
{
"name": "player",
"type": "AMAZON.US_FIRST_NAME"
}
],
"intent": "PlayerTakesDamage"
},
{
"slots": [
{
"name": "health",
"type": "AMAZON.NUMBER"
},
{
"name": "player",
"type": "AMAZON.US_FIRST_NAME"
}
],
"intent": "PlayerHeals"
}
]
}
如果我请求一个没有任何插槽的 Intent,它工作正常。为什么当他们有插槽时它找不到我的意图?
我是运行这个使用英国语言的应用程序。
尝试检查 AWS lambda 日志中是否存在请求错误。它应该为您提供失败的模块名称(例如 index.js)和异常的行号。
您还可以将 console.log() 消息添加到您的 lambda 代码中,以帮助缩小错误发生的范围。
我最终创建了两种语言,英国和美国,然后我使用新的技能构建器确保在我完成 editing/adding 我的意图和示例话语后保存并构建模型。
我还使用了不同的插槽类型,而不是 AMAZON.US_FIRST_NAME 我使用了 AMAZON.GB_FIRST_NAME 。
下面是我用来让我的 Alexa 技能正常工作的技能构建器页面设置的屏幕截图
只是指出这是交互模式的问题,目前处于测试阶段的新构建器似乎为我解决了这个问题。
请检查您的技能(lambda 方法)是否在允许的时间(7-10 秒)内响应。
首先,如果我在 alexa 应用程序开发页面上使用模拟器,一切正常,尽管请求看起来有些不同。如果我对我的 Alexa 设备说 "Ask appName {x} and {y}",那么我的 Web 服务会被调用并显示一条错误消息 "An exception occurred while dispatching the request to the skill"。 {X} 和 {Y} 是我的意图槽。
只有当直接与 Alexa 对话并且模拟器再次完美运行时才会发生这种情况。
以下是我与 Amazon Echo 对话时收到的请求。
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.6a13f2db-a9f6-43a9-bc4d-x063b86905b6c",
"application": {
"applicationId": "amzn1.ask.skill.ef8bd603-cc39-406e-bed8-a8f9xc94abba2"
},
"user": {
"userId": "xxx"
}
},
"context": {
"AudioPlayer": {
"playerActivity": "STOPPED"
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.ef8bd603-cc39-406e-bed8-a8f9c94abba2"
},
"user": {
"userId": "xxxx"
},
"device": {
"deviceId": "xx",
"supportedInterfaces": {
"AudioPlayer": {}
}
},
"apiEndpoint": "https://api.eu.amazonalexa.com",
"apiAccessToken": "xxxx"
}
},
"request": {
"type": "SessionEndedRequest",
"requestId": "amzn1.echo-api.request.2a993410-e7a8-4f37-87d7-a5063ef185b5",
"timestamp": "2017-12-22T00:11:45Z",
"locale": "en-GB",
"reason": "ERROR",
"error": {
"type": "INVALID_RESPONSE",
"message": "An exception occurred while dispatching the request to the skill."
}
}
}
下面是我的意图架构
{
"intents": [
{
"intent": "StartGameIntent"
},
{
"slots": [
{
"name": "playerOne",
"type": "AMAZON.US_FIRST_NAME"
},
{
"name": "playerTwo",
"type": "AMAZON.US_FIRST_NAME"
}
],
"intent": "PlayTheGame"
},
{
"intent": "StopTheGame"
},
{
"slots": [
{
"name": "damage",
"type": "AMAZON.NUMBER"
},
{
"name": "player",
"type": "AMAZON.US_FIRST_NAME"
}
],
"intent": "PlayerTakesDamage"
},
{
"slots": [
{
"name": "health",
"type": "AMAZON.NUMBER"
},
{
"name": "player",
"type": "AMAZON.US_FIRST_NAME"
}
],
"intent": "PlayerHeals"
}
]
}
如果我请求一个没有任何插槽的 Intent,它工作正常。为什么当他们有插槽时它找不到我的意图?
我是运行这个使用英国语言的应用程序。
尝试检查 AWS lambda 日志中是否存在请求错误。它应该为您提供失败的模块名称(例如 index.js)和异常的行号。
您还可以将 console.log() 消息添加到您的 lambda 代码中,以帮助缩小错误发生的范围。
我最终创建了两种语言,英国和美国,然后我使用新的技能构建器确保在我完成 editing/adding 我的意图和示例话语后保存并构建模型。
我还使用了不同的插槽类型,而不是 AMAZON.US_FIRST_NAME 我使用了 AMAZON.GB_FIRST_NAME 。
下面是我用来让我的 Alexa 技能正常工作的技能构建器页面设置的屏幕截图
只是指出这是交互模式的问题,目前处于测试阶段的新构建器似乎为我解决了这个问题。
请检查您的技能(lambda 方法)是否在允许的时间(7-10 秒)内响应。