我有以下代码上传到lambda,它一直给我错误:"错误消息":"RequestId:bdfa695d-e8b8-11e6-952a-21bb5e95cff6 进程在完成请求之前退出",即使我已经从完美的工作技能中修改了这段代码。代码只是告诉用户你好(用卡片),当用户说问我一个问题时,可以问他们一个问题。这是我的代码:`
var APP_ID=undefined;
var Alexa = require('./AlexaSkill');
var Sample = function () {
AlexaSkill.call(this, APP_ID);
};
var handlers = {
'LaunchRequest': function () {
this.emit(':ask', welcomeMessage, GetReprompt());
},
'Unhandled': function () {
this.emit(':ask', welcomeMessage, GetReprompt());
},
'AMAZON.HelpIntent': function () {
this.emit(':ask', HelpMessage, HelpMessage);
},
'AMAZON.StopIntent': function () {
this.shouldEndSession = true;
this.emit(':tell', stopSkillMessage, stopSkillMessage);
},
'AMAZON.CancelIntent': function () {
this.shouldEndSession = true;
this.emit(':tell', stopSkillMessage, stopSkillMessage);
},
'SaySomethingIntent': function () {
var speechOutput= "Hello";
var repromptOutput= "Say hello";
var cardTitle="Hello. This is the card title.";
var overviewMessage="This is a card.";
this.askWithCard(speechOutput, repromptOutput, howToPlayCardTitle, overviewMessage);
},
'AskIntent': function () {
var question="Hi there, what's your name?";
this.askWithCard(question);
}
}
exports.handler = function (event, context) {
var sample = new Sample();
sample.execute(event, context);
};
'任何形式的帮助,甚至是使用 AWS 的任何技巧,都将不胜感激。谢谢。
函数应回调 AWS,以通知 Lambda 它已完成所有工作。
在当前版本的 Lambda Nodejs 运行时中,您可以向处理程序调用第三个参数 callback
。
http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
在以前版本的 Nodejs 运行时中,或者如果您的处理程序未采用 callback
参数,则应在它退出之前调用 context.succeed()
或 context.fail()
。
http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html