Node.js Nodejs alexa sdk返回错误消息

Node.js Nodejs alexa sdk返回错误消息,node.js,alexa,Node.js,Alexa,当我将我的zip上传到Lambda时,我一直遇到以下错误 { "errorMessage": "RequestId: 890bda68-7b8d-11e7-be27-9f13acbc6057 Process exited before completing request" } 我看了一个教程并创建了自己的代码,这导致了相同的错误,所以我从视频中复制并粘贴了代码。 我试着上传并创建一个Lambda服务来解决这个问题。 在上传的zip中,我有index.js,package.json和模式库

当我将我的zip上传到Lambda时,我一直遇到以下错误

{
  "errorMessage": "RequestId: 890bda68-7b8d-11e7-be27-9f13acbc6057 Process exited before completing request"
}
我看了一个教程并创建了自己的代码,这导致了相同的错误,所以我从视频中复制并粘贴了代码。 我试着上传并创建一个Lambda服务来解决这个问题。 在上传的zip中,我有
index.js
package.json
和模式库

代码如下:

'use strict';

//App Variables
var Alexa = require('alexa-sdk');
var APP_ID = ""; //We'll come back to this later
var SKILL_NAME = 'Mirror Mirror';

//List of compliments to be later given in a random order
var COMPLIMENT_LIST = [
    "Damn son, you're looking mighty fine today.",
    "Wow! You made an Alexa Skill. You're smarter than I thought!",
    "If you were a food, you'd be an endless supply of Cheesecake.",
    ];

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

//Intent handlers that can be triggered.
var handlers = {
    'LaunchRequest': function () {
        this.emit('GetMirrorMirror');
    },
    /*
        When a user says a recognised phrase to Alexa the GetMirrorMirrorIntent is triggered
        This picks a random compliment from the array above and emits the :tellWithCard event.
        This event shows a card within the Amazon Echo app, and outputs the speech from speechOutput.
    */
    'GetMirrorMirrorIntent': function () {
        this.emit('GetMirrorMirror');
    },
    'GetMirrorMirror': function () {
        // Get a random compliment from the COMPLIMENTS_LIST array
        var complimentIndex = Math.floor(Math.random() * COMPLIMENT_LIST.length);
        var randomCompliment = COMPLIMENT_LIST[complimentIndex];

        // Output
        var speechOutput = "Your compliment: " +  randomCompliment;

        this.emit(':tellWithCard', speechOutput, SKILL_NAME, randomCompliment)
    },
    'AMAZON.HelpIntent': function () {
        var speechOutput = "You can say give me a compliment, or, you can say exit... What can I help you with?";
        var reprompt = "What can I help you with?";
        this.emit(':ask', speechOutput, reprompt);
    },
    'AMAZON.CancelIntent': function () {
        this.emit(':tell', 'Goodbye!');
    },
    'AMAZON.StopIntent': function () {
        this.emit(':tell', 'Goodbye!');
    }
};
1) ***第5行中的“应用程序ID”为空。您需要将其替换为Alexa开发者控制台中技能名称旁边的技能Id

例如:

var APP_ID = "amzn1.ask.skill.058ff9ec-2f5e-47c1-99fd-914581e9a41f";
2) 另外,您是否运行了node来安装依赖项。你的帖子说你有“模式”库。这是否等同于文件夹节点_模块?如果这是您第一次使用AlexaSDK,则需要运行node来下载依赖项


3) 另一个想法。如果你上传到lambda,如果你说save and test,它将运行一个测试事件。您需要在蓝色测试按钮旁边的下拉列表中配置该测试事件。使用Alexa开发者控制台中的测试工具输入一个utrance来生成JSON对象。然后可以将JSON复制到lambda中的测试事件中。注意:此JSON将包含Alexa skill的应用程序id,使我们回到可能的错误#1。Lambda将只执行来自给定应用程序的请求,以便其他程序员无法调用您的函数

当您将代码上载到Lambda时,您可以在Cloud Watch上查看日志。界面应该相当直观-您需要日志消息,因为您的问题可能是从一个小的打字错误到缺少依赖项。IIRC错误消息基本上是说您的代码在内部抛出了一个错误。不过,我有一个粗略的猜测,请确保您压缩了单个文件,而不是整个项目目录。