Getting an Error when the Lambda associated with my Lex Bot is taking too much time to respond to AWS Connect on Get Customer Input step

0

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".

Enter image description here

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. Enter image description here

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

4 Answers
0

Hi, this page https://docs.aws.amazon.com/lexv2/latest/dg/session-attribs-speech.html provides some guidance on setting Lex timeout on various utterances.

profile pictureAWS
EXPERT
answered a year ago
0

Hi, Look into the Chat time out in the Contact Flow in the get customer input block. Please refer the documentation on the Chat time out at https://docs.aws.amazon.com/connect/latest/adminguide/get-customer-input.html#get-customer-input-configurable-timeouts-chat

AWS
Phani_L
answered a year ago
0

Thank you so much for your replies @Phani_L @Didier_AWS Unfortunately, it didn't seem the fix the problem.

Here is how I set the attributes: Enter image description here Enter image description here

The AWS Connect Log still doesn't provide any useful information. Enter image description here

t_d_lkl
answered a year ago
0

Hello! I found in the solution that there is a timeout associated to the Lex response time when used with Connect.

According to the documentation: https://docs.aws.amazon.com/connect/latest/adminguide/feature-limits.html

Feature specifications cannot be increased.

Chat Amazon Lex bot integration timeout: 6 seconds
The maximum time within which the Amazon Lex bot must respond to the chat customer's prompt.

It seems that it is a hard limit. The only way would be to create your own UI and make it interact with Lex directly. You can maybe take some inspiration from this repository: https://github.com/aws-samples/aws-lex-web-ui

Hope that helps!

Tony
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions