我在調用帶回調的另一個函數的lambda函數中調用以下函數。在回調內部,響應對象似乎沒有得到正確處理,因爲它在alexa模擬器中給出響應無效的錯誤。函數看起來像lambda函數responde對象沒有處理
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響應之外的工作完全正常。我不確定這裏出了什麼問題。 lambda功能日誌顯示沒有錯誤等