qnabot-on-aws icon indicating copy to clipboard operation
qnabot-on-aws copied to clipboard

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

Open tabrza opened this issue 4 years ago • 3 comments

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!

tabrza avatar Nov 02 '20 08:11 tabrza

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.

bobpskier avatar Nov 03 '20 14:11 bobpskier

Thanks @bobpskier - look forward to this

tabrza avatar Nov 04 '20 06:11 tabrza

@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?

bobpskier avatar Nov 09 '20 14:11 bobpskier