Hello!
I am building a chatbot using:
- AWS Connect & AWS Connect Chat Widget
- AWS Lex with Lambda integration
- AWS Lambda for calling ChatGPT API
It is working well when AWS Lambda (and the underlying call to ChatGPT API) responds fast (under 10 seconds) but when it is taking longer than that, the AWS Connect Chat Widget automatically gets interrupted with the following message: "Chat has ended".
I looked at the AWS Connect logs and it seems like I got the following error:
{
"Results":"Error",
"ContactId":"xxxxxxxxxxxx",
"ContactFlowId":"arn:aws:connect:ap-northeast-1:xxxxxxxxxxx:instance/xxxxxxxxxxxxx/contact-flow/xxxxxxxxxxxxx",
"ContactFlowName":"ChatGPT Bot Contact Flow (dev)",
"ContactFlowModuleType":"GetUserInput",
"Timestamp":"2023-06-15T04:36:53.003Z"}
Looking at my lambda logs, the Lambda itself does not have any issues.
REPORT RequestId: 01e44a82-9ae2-468f-be8b-d79e5a4eb9dc Duration: 19949.29 ms Billed Duration: 19950 ms Memory Size: 512 MB Max Memory Used: 124 MB
The Connect log error is occurring before the Lambda log, so I guess Connect has timed out.
When I tested the Lex bot on the AWS console, even when responses from Lambda are taking a long time to come, there was no timeout or error so I guess the problem is between Connect and Lex.
I was wondering if there is a way to increase the timeout of Lex responses for AWS Connect?
I tried many many things such as modifying the DTMF timeout, setting x-amz-lex:text:start-timeout-ms:: attribute ... But nothing worked.
Thank you very much!
Tony