I've read the Lex Docs on Responses.
I've searched and found:
- An unanswered question on same error.
- An unanswered similar question but in Python.
- An unanswered similar question in Amazon Dev Forum.
So my question remains. What is causing / How to fix this error in Lex chat bot:
An error has occurred: Invalid Lambda Response:
Reached second execution of fulfillment lambda on the same utterance
The error is only occurring when attempting to respond with Delegate. Here is my AWS lambda (node.js 6.10) code for the Delegate response:
exports.handler = (event, context, callback) => {
try {
intentProcessor(event,
(response) => {
callback(null, response);
});
} catch (err) {
callback(err);
}
};
function intentProcessor(intentRequest, callback) {
respond = delegate(sessionAttributes,intentRequest['currentIntent']['slots']);
callback(respond);
}
function delegate(sessionAttributes, slots){
return {
sessionAttributes,
dialogAction: {
type: "Delegate",
slots
}
};
}
I've confirmed that the response is returning as expected with the minimum requirements for Delegate per Docs, which are sessionAttributes and DialogAction: type and slots. The slots are returning null as expected.
Additional possibly relevant information:
- The intent has multiple utterances.
- The intent has multiple slots.
- None of the slots are required.
Any suggestions or information on what might cause this error is much appreciated!