By using AWS re:Post, you agree to the Terms of Use

V2 Lex Order Flowers Lambda error

0

I am following the V2 Lex Developer Guide to create a bot from the OrderFlowers Blueprint. When I add the Lambda function to the bot (page 145 of the V2 Guide), I receive the error below. Any idea why this is happening? I have followed the steps in the V2 Developer Guide.

Invalid Lambda Response: Your request to Amazon Lex couldn't be completed. Lambda function arn:aws:lambda:us-east-1:994504927747:function:OrderFlowersCodeHook:OrderFlowersCodeHook encountered a problem while processing Amazon Lex request 6406cf16-5cd5-4c72-8a2a-fed1717e5e3a. The error message from the Lambda function is Unhandled. Check the Lambda function log for error details, then try your request again after fixing the error.

  • Hi, @Jennifer.
    What is output in the Lambda function log?

  • There is no output in the Lambda logs within CloudWatch. The AWS X-ray Map shows a picture of the client invoking the Lambda function. The CloudWatch Trace references a "Error (4xx)" but I can't see what it is.

    I am new to using Lex, Lambda, and Cloudwatch. I turned on XRay and Lambda Log Insights but I can't find any details on what happening.

  • I deleted the Lambda function and started over. I now see the following errors in the CloudWatch logs:

    [ERROR] KeyError: 'userId' Traceback (most recent call last):   File "/var/task/lambda_function.py", line 206, in lambda_handler     return dispatch(event)   File "/var/task/lambda_function.py", line 182, in dispatch     logger.debug('dispatch userId={}, intentName={}'.format(intent_request['userId'], intent_request['currentIntent']['name']))