Skip to content

Conversation

@calavera
Copy link
Contributor

This deserializer gives us full control over the error message that we return for invalid payloads. The default message that Serde returns is usually very confusing, and it's been reported many times as something people don't understand.

This code is a copy of the code that Serde generates when it expands the Deserialize macro.

Previous error message:

failed to deserialize the incoming data into the function's payload type: data did not match any variant of untagged enum LambdaRequest

New error message:

failed to deserialize the incoming data into the function's payload type: this function expects a JSON payload from Amazon API Gateway, Amazon Elastic Load Balancer, or AWS Lambda Function URLs, but the data doesn't match any of those services' events

By submitting this pull request

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I confirm that I've made a best effort attempt to update all relevant documentation.

This deserializer gives us full control over the error message that we return for invalid payloads. The default message that Serde returns is usually very confusing, and it's been reported many times as something people don't understand.

This code is a copy of the code that Serde generates when it expands the Deserialize macro.

Signed-off-by: David Calavera <david.calavera@gmail.com>
@calavera calavera requested a review from bnusunny June 21, 2023 23:27
@calavera calavera merged commit f47d448 into main Jun 22, 2023
@calavera calavera deleted the custom_http_deserializers branch June 22, 2023 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants