【问题标题】:How to solve "There was a problem with the requested skill's response" in Alexa Developer Console如何在 Alexa Developer Console 中解决“请求的技能响应有问题”
【发布时间】:2019-09-27 07:30:24
【问题描述】:

我正在尝试为 Alexa 构建一个简单的应用程序,其中用户说出调用名称(语音控制统一),然后说出自定义意图 (TempIntent) 中描述的话语(临时世界)以使用 buildSpeechletResponse ie(temp要求)。 但我在 Alexa 开发人员控制台的“测试”选项卡中收到“请求的技能响应有问题”错误。

我已经尝试更改意图名称、调用名称、函数名称,但没有任何效果。

//This is index.js file lambda function

function onLaunch(launchRequest, session, response)
{
  var output = 'Welcome to Temp World';

  var reprompt = 'Type temp world';

  response(session.attributes,
   buildSpeechletResponseWithoutCard(output, reprompt,false));

  console.log("onLaunch requestId=" + launchRequest.requestId
    + ", sessionId=" + session.sessionId);

}

function onIntent(intent, session, response) {

   console.log("onIntent requestId=" + intent.requestId
    + ", sessionId=" + session.sessionId);

   var intent = intentRequest.intent,
    intentName = intentRequest.intent.name;

 if(intentName == 'TempIntent') {
   handleTempRequest(); 
   } 
else {
    throw "Invalid intent";
}
}


function handleTempRequest()
{

  buildSpeechletResponse("", "welcome to temp world", "", true);

}

function buildSpeechletResponse(title, output, repromptText, 
shouldEndSession) {
   return {
    outputSpeech: {
        type: "PlainText",
        text: output
    },
    card: {
        type: "Simple",
        title: title,
        content: output
    },
    reprompt: {
        outputSpeech: {
            type: "PlainText",
            text: repromptText
        }
    },
    shouldEndSession: shouldEndSession
   };
}

我希望输出是“欢迎来到临时世界”,但 JSON 输出为空。

JSON 输入是

"request": {
"type": "SessionEndedRequest",
"requestId": "amzn1.echo-api.request.c78c093c-eb05-4eaa-8f23-16037059e61f",
"timestamp": "2019-05-09T12:23:34Z",
"locale": "en-US",
"reason": "ERROR",
"error": {
    "type": "INVALID_RESPONSE",
    "message": "An exception occurred while dispatching the request to the skill."
   }
  }

Image showing Alexa conversation

【问题讨论】:

  • 你在使用AWS lambda函数吗?如果是,请在此处添加 CloudWatch 日志。
  • "errorMessage": "异常:ReferenceError:intentRequest 未定义"
  • 我的开发者控制台中已经有“TempIntent”意图,其中内置了“临时世界”示例话语。
  • 即使我得到同样的错误,但 JSON 输出没有任何内容。
  • 感谢 @pedro.olimpio 建议检查 CloudWatch 日志。我正在开发我的第一项技能并且遇到了同样的错误,我意识到我的包含字符串的 .js 文件中有语法错误(我使用了撇号并忘记了逗号)。不幸的是,日志没有说明这一点,我只是自己注意到了。但是我仍然收到错误消息,在这种情况下,日志确实描述了错误,即我引用了一个已删除的 Intent。

标签: javascript node.js aws-lambda alexa-skills-kit


【解决方案1】:
  1. 检查您使用的 node.js 版本。
  2. 在 lambda 函数中单击测试选项卡并测试每个意图,您会发现问题所在。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-23
    • 1970-01-01
    • 2019-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多