Alexa lambda函数默认为未处理?

时间:2017-12-17 03:22:36

标签: aws-lambda launch alexa alexa-skills-kit unhandled-exception

下面是我的Alexa lambda函数的代码,删除了所有数据和其他意图。我遇到的问题是我的lambda函数似乎没有启动,我不断得到输出,“抱歉,我不知道该怎么做”意味着它将进入未处理的函数。有人可以建议吗?

var Alexa = require('alexa-sdk');
const APP_ID = 'amzn1.ask.skill.353021cb-577e-4cfc-9edd-b440e6f095fe';

var handlers = {
   'LaunchRequest': function() {
    this.emit(':tell', 'I can help you pick your tie. Tell me the color of your outfit, pattern of your shirt, or pattern of your tie.','Tell me the color of your outfit, pattern of your shirt, or pattern of your tie.');

    },
'Unhandled': function() {
    this.emit(':tell','Sorry, I don\'t know what to do');

    },
    };

exports.handler = function(event,context){
    var alexa = Alexa.handler(event,context);
    alexa.registerHandlers(handlers);
    alexa.execute();
};

1 个答案:

答案 0 :(得分:1)

你是如何测试你的技能的?如果您使用('旧的')服务模拟器对其进行测试,则表示您未获得LaunchRequest类型的请求,但IntentRequest具有最佳匹配意图你的互动模式 - 就像你用Alexa这样的意图调用你的技能时,要求领带挑选者选择领带。

如果你想要这么深的'调用以触发您的第一个处理程序,您可以将LaunchRequest替换为NewSession

希望有所帮助!