question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[AWS Lex] "null" values from Lex v2 Chatbot Request

See original GitHub issue

Context

  • 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 LexEvent does not populate the expected fields, such as CurrentIntent and SlotDetails.
  • Compare this to using the Python or Node.js blueprints which do populate the expected fields.

Reproduction Steps

  1. Create a new .NET project using the “AWS Lambda Project (.NET Core - C#)” template with the “Order Flowers Chatbot” Blueprint.
  2. Log the lexEvent variable to CloudWatch within the FunctionHandler function: LambdaLogger.Log(JsonSerializer.Serialize(lexEvent));
  3. Publish the solution to AWS Lambda (default settings, arbitrary function name).
  4. Create a new Lex v2 Chatbot with the “Order Flowers Chatbot” Example.
  5. Configure the new chatbot to use the new lambda function you uploaded under Bot > Alias > Language.
  6. Under Intents > OrderFlowers > Fulfillment > Advanced Options, ensure “Use a Lambda function for fulfillment” is checked.
  7. Save the intent, build the bot, and test the conversation.
  8. An error should appear when attempting to fulfill the intent - when you check CloudWatch, the LexEvent body should appear with null values for fields such as CurrentIntent and SlotDetails.

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
omf-jnguyencommented, Mar 15, 2022

@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

  • Disclaimer: C# is not my primary language so definitely could use a look-over and suggestions if anyone has any!
1reaction
1bbertocommented, Mar 10, 2022
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found