【发布时间】:2023-03-17 04:49:01
【问题描述】:
当我在 Lambda 内联代码编辑器上测试代码时,我总是收到这个错误:
"errorMessage": "RequestId: b8efba3e-8940-11e7-a176-e7452208b749 Process exited before completing request"
这是代码(我用亚马逊的示例表单替换了我的代码,只是为了看看它是否只是我的代码):
'use strict';
var Alexa = require("aws-sdk");
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.registerHandlers(handlers);
alexa.execute();
};
var handlers = {
'LaunchRequest': function () {
this.emit('SayHello');
},
'HelloWorldIntent': function () {
this.emit('SayHello');
},
'SayHello': function () {
this.emit(':tell', 'Hello World!');
}
};
【问题讨论】:
-
这个语句末尾好像没有分号。 "HelloWorldIntent': function () { this.emit('SayHello') }"
-
添加了 ; ,但仍然有同样的错误
-
你检查过处理函数中“this”的值是否正确吗?
-
对日志做了更多的挖掘,它说 Alexa.handler 不是一个函数
标签: node.js aws-lambda alexa alexa-skills-kit