ラムダに自分のzipをアップロードしても、次のエラーが発生します。Nodejs alexa-sdkがerrorMessageを返す
{
"errorMessage": "RequestId: 890bda68-7b8d-11e7-be27-9f13acbc6057 Process exited before completing request"
}
私はチュートリアルを見て、同じエラーを引き起こした自分のコードを作成しました。代わりに、ビデオからコードをコピーして貼り付けました。 ラムダサービスをアップロードして作成しようと試みました。 アップロードされた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!');
}
};
コードをLambdaにアップロードすると、Cloud Watchのログを確認できます。インターフェイスはかなり直観的でなければなりません。あなたの問題はマイナーなタイプミスから依存性の欠如まで何でもよいので、ログメッセージが必要になります。 IIRCのエラーメッセージは基本的にあなたのコードが内部的にエラーを投げたと言っています。私は野生の推測を持っていますが、プロジェクトディレクトリ全体ではなく個別のファイル_を圧縮してください。 – spicypumpkin