aws-solutions / qnabot-on-aws

AWS QnABot is a multi-channel, multi-language conversational interface (chatbot) that responds to your customer's questions, answers, and feedback. The solution allows you to deploy a fully functional chatbot across multiple channels including chat, voice, SMS and Amazon Alexa.
https://aws.amazon.com/solutions/implementations/aws-qnabot
Apache License 2.0
392 stars 251 forks source link

AWS Lex + QnA stack lambda 424 error when coupled with Interactions #229

Closed tabrza closed 1 year ago

tabrza commented 3 years ago

I'm building a question and answer bot using the QnA launch stack. After training some questions in the bot designer, I am able to interact with it there as well as directly within lex indicating that the lambda function associated with QnA is working as intended. However, when creating a react app and setting it up with interactions, I get a lambda 424 errors. This works with sample bots (orderflower, booktrip etc.) and with bots I have made previously using the same launch stack.

Going through the logs i get the following invoke error:

{
    "errorType": "TypeError",
    "errorMessage": "Cannot convert undefined or null to object",
    "stack": [
        "TypeError: Cannot convert undefined or null to object",
        "    at Array.preprocess (/var/task/lib/middleware/2_preprocess.js:130:31)"
    ]
}

See image of logs here

This points me to the following code on github. What I gather from here is that interactions is not sending a jwt? I'm not sure how to resolve this as I haven't encountered this error previously with my bots and it is working with bots i've built previously using the same launch stack. I deployed across different regions jsut to confirm it wasn't a deployment issue but encountered the same 424 error..

Any help/guidance would be appreciated!

bobpskier commented 3 years ago

The initial request from the amplify chatbot appears to not set Lex sessionAttributes. The code in question attempts delete properties assuming sessionAttributes is available causing the exception. Working on a resolution in the code and will push an update shortly that should address the issue.

tabrza commented 3 years ago

Thanks @bobpskier - look forward to this

bobpskier commented 3 years ago

@tabrza QnABot version 4.3.2 was pushed out last night. Could you upgrade to this version and/or try a fresh install to confirm resolution of this issue?