aws-lex-web-ui
aws-lex-web-ui copied to clipboard
Sorry, I had an error handling this conversation.
Hello @bobpskier, I deployed the stack and I am getting the following error when I click the mic : "Sorry, I had an error handling this conversation.". I don't know where to start to begin to debug this problem. Any guidance will be appreciated. FYI, I also noticed that the Lex session variables are not being updated in the parent.html page as I chat with the bot via text.
I tried it with the default order flowers Lex bot stack and it works. My bot takes sometime to gather the data. Is there a variable which I can use to extend the amount of time to wait for my Lambda function to execute?
@ObsidianDelta Most likely the LexWebUi is seeing an error returned from the call to the Lex service. It could be a timeout or some other problem. The browser's debugger Network tab will help indicate what the problem might be. After clicking send, the network tab in the debugger will show the LexWebUi's post request which is sent to the lex service. This response is most likely an error. Open the specific network request and open up the response tab. Hopefully you'll see the error more visibly. If the error is a timeout, I believe Lex has a 30 second timeout itself from any back-end function that you might be calling independent of the Lambda function's timeout. This means your lambda function must respond back within this time.
Hello @bobpskier the issue was with Cognito ... and just as you said the error message was shown on the network tab. However, I am getting the same message when I use the microphone and there is no error message on the network tab! Any idea why the voice functionality is not working?
P.S Thanks for you help :)
Hello @bobpskier ... Just FYI when I click the microphone it plays the initial speech MP3 and then it listens to the speech and it gets to the processing stage. But then I get the same error message. Thanks.
@ObsidianDelta I'm attempting to recreate the problem you might be seeing but so far have not been able to. After clicking on the microphone button and saying your input, does the network tab in the browser debugger show a 403 response to the POST request to Lex V2? I'm wondering if the correct sequence targeting the correct BOT is being made.
A normal sequence would look like the following after clicking the microphone:
GET request to d*****.cloudfront.net for "initial_speech_en_US.mp3"
200 Response to GET request
This mp3 is played to the user
OPTIONS request to runtime-v2.lex.yourregion.amazonaws.com for "utterance"
200 Response to OPTIONS request
POST request to runtime-v2.lex.yourregion.amazonaws.com for "utterance"
200 Response to POST request
The response is played to the user.
Could you capture the request/response indicating the error and provide for analysis? If not, can you provide the URL to lexwebui to test with that reproduces the problem?
Hello @bobpskier . It looks like the post to the LexV2 is not being made. Here is the URL of the bot: https://d2wogh3uln1hfe.cloudfront.net/index.html. Thanks.
@ObsidianDelta On my system/browser (firefox) all three requests to your lex-web-ui are being made and completed with proper return status.

I would next look at the backend handling the Lex response and perhaps augmenting the output. Is there a lambda function being utilized by the Bot? Are you logging all errors/output from this lambda? Does any of this logging indicate any sort of permission error? Next I would look at the SSML being returned by the lambda / bot and validate that the SSML is properly formatted for Lex to consume.
Hello @bobpskier I think that it is a permission error: AccessDeniedException: User: arn:aws:sts::4XXXXXXXXXXassumed-role/lex-web-ui-CognitoIdentityPool-CognitoUnauthRoleV2-8XXXXXXXXXX/CognitoIdentityCredentials is not authorized to perform: polly:SynthesizeSpeech because no identity-based policy allows the polly:SynthesizeSpeech action
I guess my question is where do I go to give permission to the assumed role?
P.S I keep coming back to the problem because it hasn't been high priority till now :)
hi @bobpskier @atjohns @ObsidianDelta I think this issue has been addressed since polly:SynthesizeSpeech is assigned to both IAM role for Lex v1 and Lex v2
Thanks for the update @sleepwithcoffee I'll close this one out then