コールバックを持つ別の関数を呼び出すラムダ関数で、次の関数を呼び出しています。コールバックの中で、応答オブジェクトは、alexaシミュレータで応答が無効なエラーを返すので、適切に扱われないようです。関数は次のようになります。ラムダ関数の応答オブジェクトが処理されない
function handleFirstEventRequest(intent, session, response) {
var repromptText = "With History Buff, you can get historical events for any day of the year. For example, you could say today, or August thirtieth. Now, which day do you want?";
var sessionAttributes = {};
var cardContent = "";
var cardTitle = "Events on ";
//response.tell("There is an issue here vik");
getJsonEventsFromWikipedia(function (events) {
var speechText = "";
sessionAttributes.text = events;
session.attributes = sessionAttributes;
if (events.length == 0) {
speechText = "There is a problem connecting to Wikipedia at this time. Please try again later.";
cardContent = speechText;
response.tell(speechText);
} else{
console.log("vik::::::::::::: wikipedia response received");
console.log("values are:" + events);
var speechOutput = {
speech: "hi how are you",
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
var repromptOutput = {
speech: "hi how are you",
type: AlexaSkill.speechOutputType.PLAIN_TEXT
};
console.log("before response");
response.ask(speechOutput, repromptOutput);
console.log("after response");
}
});
}
ただし、getJsonEventsFromWikipediaのレスポンスの外は完全に正常です。私はここで何がうまくいかないと確信していません。ラムダファンクションログにエラーなどが表示されない