나는 LaunchRequest 후에 초기 환영 메시지가 StartGame 함수에서 재생되어 사용자에게 학교를 요청한 다음 SetSchool 인 텐트에 자신의 학교를 말합니다. 그 기술은 메시지를 말합니다. 바로 지금 마지막 부분에 버그가 있으며 디버깅하는 방법을 모르겠습니다.Alexa ASK 람다 버그
내 코드 : 그것은 여기에 딱 맞는 있도록
/* eslint-disable func-names */
/* eslint-disable dot-notation */
/* eslint-disable new-cap */
/* eslint quote-props: ['error', 'consistent']*/
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills
* nodejs skill development kit.
* This sample supports en-US lauguage.
* The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
* as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-trivia
**/
'use strict';
const Alexa = require('alexa-sdk');
const questions = require('./question');
const ANSWER_COUNT = 4; // The number of possible answers per trivia question.
const GAME_LENGTH = 10; // The number of questions per trivia game.
const GAME_STATES = {
TRIVIA: '_TRIVIAMODE', // Asking trivia questions.
START: '_STARTMODE', // Entry point, start the game.
HELP: '_HELPMODE', // The user is asking for help.
};
const APP_ID = undefined; // TODO replace with your app ID (OPTIONAL)
const languageString = {
'en': {
'translation': {
'QUESTIONS': questions['HS_QUESTIONS_EN_US'],
'GAME_NAME': 'Science Bowl',
'HELP_MESSAGE': 'I will ask you %s multiple choice questions. Respond with the number of the answer. ' +
'For example, say one, two, three, or four. To start a new game at any time, say, start game. ',
'REPEAT_QUESTION_MESSAGE': 'To repeat the last question, say, repeat. ',
'ASK_MESSAGE_START': 'Would you like to start playing?',
...
},
},
};
const newSessionHandlers = {
'LaunchRequest': function() {
this.handler.state = GAME_STATES.START;
this.emitWithState('StartGame', true);
},
'SetSchool': function() {
this.handler.state = GAME_STATES.START;
this.emitWithState('School', true);
},
'AMAZON.StartOverIntent': function() {
this.handler.state = GAME_STATES.START;
this.emitWithState('StartGame', true);
},
'AMAZON.HelpIntent': function() {
this.handler.state = GAME_STATES.HELP;
this.emitWithState('helpTheUser', true);
},
'Unhandled': function() {
const speechOutput = this.t('START_UNHANDLED');
this.emit(':ask', speechOutput, speechOutput);
},
};
...
const startStateHandlers = Alexa.CreateStateHandler(GAME_STATES.START, {
'StartGame': function (newGame) {
let speechOutput = newGame ? this.t('NEW_GAME_MESSAGE', this.t('GAME_NAME')) + this.t('WELCOME_MESSAGE', GAME_LENGTH.toString()) : '';
this.handler.state = GAME_STATES.START;
this.emit(':ask', speechOutput, speechOutput);
},
'School': function(newGame) {
this.handler.state = GAME_STATES.START;
this.response.speak('test');
this.emit(':responseReady');
}
});
exports.handler = function (event, context) {
const alexa = Alexa.handler(event, context);
alexa.appId = APP_ID;
// To enable string internationalization (i18n) features, set a resources object.
alexa.resources = languageString;
alexa.registerHandlers(newSessionHandlers, startStateHandlers, triviaStateHandlers, helpStateHandlers); // these were defined earlier
alexa.execute();
};
나는 대부분의 코드를 제외. 시도하고 디버깅하고 싶지만 오류 메시지를 보는 방법조차 모릅니다. 나는 무엇을해야합니까?
질문을 확인하십시오 .js. 귀하의 질문 중 하나가 있습니다. 끝? json을 처리하는 동안 이러한 오류가 발생했습니다 ... 또한 cloudwatch에서 로그를 캡처하고 업로드하십시오. –