[AWS Lex] "null" values from Lex v2 Chatbot Request
See original GitHub issueContext
- Goal: Setup blueprint “OrderFlowers” chatbot with AWS Lex v2 using .NET Core 3.1 and AWS Lambda. (Link)
- This may be an issue with Lex v2 rather than with Lambda, but this may be unlikely as Python and Node.js work fine when interchanged with the .NET lambda used.
Description
- When invoking the OrderFlowers blueprint lambda function via AWS Lex, the
LexEventdoes not populate the expected fields, such asCurrentIntentandSlotDetails. - Compare this to using the Python or Node.js blueprints which do populate the expected fields.
Reproduction Steps
- Create a new .NET project using the “AWS Lambda Project (.NET Core - C#)” template with the “Order Flowers Chatbot” Blueprint.
- Log the
lexEventvariable to CloudWatch within the FunctionHandler function:LambdaLogger.Log(JsonSerializer.Serialize(lexEvent)); - Publish the solution to AWS Lambda (default settings, arbitrary function name).
- Create a new Lex v2 Chatbot with the “Order Flowers Chatbot” Example.
- Configure the new chatbot to use the new lambda function you uploaded under Bot > Alias > Language.
- Under Intents > OrderFlowers > Fulfillment > Advanced Options, ensure “Use a Lambda function for fulfillment” is checked.
- Save the intent, build the bot, and test the conversation.
- An error should appear when attempting to fulfill the intent - when you check CloudWatch, the LexEvent body should appear with
nullvalues for fields such asCurrentIntentandSlotDetails.
Logs
Lex
Invalid Lambda Response: Received error response from Lambda: Unhandled
CloudWatch
{
"CurrentIntent": null,
"SlotDetails": null,
"Bot": {
"Name": "OrderFlowersBot",
"Alias": null,
"Version": "DRAFT"
},
"UserId": null,
"InputTranscript": "yes",
"InvocationSource": "FulfillmentCodeHook",
"OutputDialogMode": null,
"MessageVersion": "1.0",
"SessionAttributes": null,
"RequestAttributes": null,
"AlternativeIntents": null,
"SentimentResponse": null,
"RecentIntentSummaryView": null,
"ActiveContexts": null
}
Environment
- Build Version: Amazon.Lambda.Core 2.1.0, Amazon.Lambda.LexEvents 3.0.0, Amazon.Lambda.Serialization.SystemText 2.2.0
- OS Info: Windows 10 Enterprise
- Build Environment: Visual Studio 2019
- Targeted .NET Platform: .NET Core 3.1
Resolution
- There may be an issue serializing the incoming request from Lex v2 based on the configuration laid out in the current Order Flowers .NET 3.1 blueprint. To resolve this, effort will need to be made comparing the expected Lex v2 request payload with the actual payload and the serialization may have to be adjusted accordingly.
This is a 🐛 bug-report
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
[AWS Lex] "null" values from Lex v2 Chatbot Request
Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions. - [AWS Lex] "null" values from Lex v2 Chatbot Request...
Read more >Re-eliciting slots - Amazon Lex
Set the slot value you want to re-elicit to null . · In the dropdown menu under Next step in conversation, choose Elicit...
Read more >Set values during the conversation - Amazon Lex
Learn how to set slot and session attribute values during a conversation with Amazon Lex V2.
Read more >node.js - I am creating a Chatbot using amazon Lex and ...
I am creating a Chatbot using amazon Lex and amazon Lambda, I just want to know I I receive "NULL"
Read more >Amazon Lex v2 Chatbot session not updating
I am trying to make a Lex Chatbot with lambda validations in .NET, if the slot input is valid it should ask for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@1bberto - yup, realized that so I ended up implementing my own custom models based on v2. Now works like a charm for me!
Here’s a gist in case anyone else wants to use them: https://gist.github.com/omf-jnguyen/dbd6cfebeb82780976038e1514a6ecb6
Its related to the version! Lex V1: https://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html
And V2: https://docs.aws.amazon.com/lexv2/latest/dg/lambda.html#lambda-input-format
I`m facing the same issue!