2017-08-07 2 views
0

ラムダに自分の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!'); 
    } 
}; 
+0

コードをLambdaにアップロードすると、Cloud Watchのログを確認できます。インターフェイスはかなり直観的でなければなりません。あなたの問題はマイナーなタイプミスから依存性の欠如まで何でもよいので、ログメッセージが必要になります。 IIRCのエラーメッセージは基本的にあなたのコードが内部的にエラーを投げたと言っています。私は野生の推測を持っていますが、プロジェクトディレクトリ全体ではなく個別のファイル_を圧縮してください。 – spicypumpkin

答えて

-1

1)は5行目 "APP_ID" で***ブランクです。これは、あなたのスキルの名前の横にあるAlexa Developer ConsoleのスキルIDで置き換える必要があります。例えば

var APP_ID = "amzn1.ask.skill.058ff9ec-2f5e-47c1-99fd-914581e9a41f"; 

2)また、あなたは依存関係をインストールするノードを実行しました。あなたの記事はあなたに "モード"ライブラリがあると言います。これはnode_modulesというフォルダに相当しますか? Alexa-SDKを初めて使用する場合は、ノードを実行して依存関係をダウンロードする必要があります。

3)別の考え。ラムダにアップロードしている場合は、保存とテストを行うとテストイベントが実行されます。青のテストボタンの横にあるドロップダウンで、そのテストイベントを設定する必要があります。 Alexa Developer Consoleのテストツールを使用して、JSONオブジェクトを生成するためのuteranceを入力します。 JSONをラムダのテストイベントにコピーすることができます。注:このJSONには、AlexaスキルのApp idが含まれており、エラー#1に戻ります。ラムダは与えられたアプリケーションからの要求に対してのみ実行し、他のプログラマーはあなたの関数を呼び出せません。

関連する問題