- Newest
- Most votes
- Most comments
The error you're encountering suggests that your Lambda function is returning a response in an incorrect format for Lex V2. It appears you're using the older Lex V1 response format, which is not compatible with Lex V2.
To fix this issue, you need to update your Lambda function to return the response in the correct Lex V2 format. Here's how you should structure your response:
-
The top-level of the response should contain a "sessionState" object and a "messages" array.
-
Inside "sessionState", include:
- "dialogAction" with "type" set to "Close"
- "intent" object with "name" (matching your intent name), "state" set to "Fulfilled", and "confirmationState"
-
Put your message content in the "messages" array.
Here's an example of how your response should look:
{ "sessionState": { "dialogAction": { "type": "Close" }, "intent": { "confirmationState": "Confirmed", "name": "I_qna_intent", "state": "Fulfilled" } }, "messages": [ { "contentType": "PlainText", "content": "This is I_qna_intent response from qna" } ] }
Make sure to adjust the intent name and other details as necessary for your specific bot configuration. By structuring your Lambda response in this format, you should resolve the "Invalid Lambda Response" error and successfully integrate your QnA bot responses with your Lex V2 bot.
Sources
Trouble with Fulfillment response from Lambda for Lex V2 Bot | AWS re:Post
How to add/Method for adding Session Attribute in Amazon Lex bot Event towards Lambda Function | AWS re:Post
