Skip to content

Lex V2 + Lambda + Test chat

0

Hi, I'm testing a lex bot v2, I have attached a fulfillment lambda to it. In the AWS console web UI for Lex, in my version of lexbot, I'm using the "test" button to start a chat session. However, when elicitation is complete and the lambda is invoked, I don't see either the "starting response" nor any update message I have set while the lambda is running. The lambda takes around 30 seconds to finish, while in the chat window it only waits around 10 seconds (I see the waiting ellipsis in the chat) and a default message I didn't set (IntentX is fulfilled) is printed. Any idea what's happening? If I force the lambda to finish in less than approx 10 seconds, it seems to work normally.

asked a year ago326 views
1 Answer
0

The behavior you're experiencing is likely related to how Amazon Lex V2 handles fulfillment updates and timeouts in different interaction modes. When using the "test" button in the AWS console web UI for Lex, you're likely using a non-streaming conversation mode, which behaves differently from streaming conversations.

In non-streaming conversations, such as when using the RecognizeText or RecognizeUtterance operations (which the test chat likely uses), the start response and update messages are not returned. These messages are typically only used in streaming conversations initiated with the StartConversation operation.

The default timeout for non-streaming conversations is usually around 8-10 seconds. If your Lambda function takes longer than this to complete, Lex will time out and return a default message, which explains why you're seeing "IntentX is fulfilled" after about 10 seconds.

To address this issue, you have a few options:

  1. Optimize your Lambda function to complete within the timeout period (around 8-10 seconds).

  2. If possible, test your bot using a streaming conversation mode, which would allow you to see the start and update responses.

  3. Configure a post-fulfillment response in your Lex bot. This response is played back for both streaming and non-streaming conversations and can provide a more informative message when the Lambda function times out.

  4. If you need longer processing times, consider implementing an asynchronous pattern where the Lambda function quickly acknowledges the request and then continues processing in the background, possibly updating the user through a different channel.

Remember that the behavior you're seeing in the test chat may not necessarily reflect how your bot will behave in a production environment, especially if you're planning to use streaming conversations.

In case if you still observe any issues, then we need some non-public details. Please use the following link to open a support case with the AWS Support team for further investigation: https://console.aws.amazon.com/support/home#/case/create

Sources
Configuring fulfillment progress updates for your Lex V2 bot - Amazon Lex
Invoke dialog code hook - Amazon Lex

answered a year ago
AWS
SUPPORT ENGINEER
reviewed a year 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.