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

lex / lambda order flowers blueprints give invalid lambda response error

1

the order flowers blueprint runs fine on lex through console but when the lambda blueprint is attached the test fails with "Invalid Lambda Response: Received error response from Lambda: Unhandled"

the log shows the error: [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'])) [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']))

the reuse of the function for fulfillment and validation is very hard to follow because the doc says:

In the Editor, choose AWS Lambda function as Fulfillment, and select the Lambda function that you created in the preceding step (OrderFlowersCodeHook). Choose OK to give Amazon Lex permission to invoke the Lambda function.

..... the problem is there is no choice for the lambda function in that form nor is there one in the validation form!!!
there is a reference to the function being stored in an alias but i cant find a way to tie this together.

i have really tried to follow the documentation systematically but cant get through it.
where am i going off the rails??? shouldnt the blueprint run without this stumbling block? this has cost me a month of hair pulling agony and is really the first step in building an index for my knowledge system already running on aws where a session could build a compound index such as "Application:Billing\Function:Encounters\Process:Create\Plan:BlueCross\Product:PPO\Coverage:Medical\Service:Physical\FromDate:01-01-2022"

it seems like a natural way to specify types and values in a modern interface.

Thanks, AEH

2 Answers
0

Hi

Amazon Lex has 2 versions. The lab that you are working on is part of Amazon Lex v1 (https://docs.aws.amazon.com/lex/latest/dg/gs-bp-create-bot.html). You are running into an issue since the lab is being executed on Amazon Lex v2 console. In order to execute the lab, you will need to change to the Lex v1 console. This can be done when selecting Amazon Lex service and selecting Return to the V1 console on the left navigation pane. A similar lab is available for Amazon Lex V2 that can be found here (https://docs.aws.amazon.com/lexv2/latest/dg/building-bots.html).

You can find more information about Amazon Lex v2 here - https://docs.aws.amazon.com/lexv2/latest/dg/what-is.html

answered 6 months ago
  • The v2 Developer Guide doesn't address the issue. It is not working for me either.

0

The problem is the Lex V2 has a different input and response format than V1. The Lambda Blueprint Order Flowers uses the V1 format. I believe the Lambda code needs to be revised to match the V2 format. Refer to Migrating a Lambda function in the documentation to see the differences: docs.aws.amazon.com/lex/latest/dg/message-lambda.html

answered 5 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