You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
EventLoader unable to correctly deserialize posted json body data for APIGateway events #432
All the documentation and examples I've found only use a string as the body, but this is a fairly common use case (an HTTP API accepting json data into a POST for updating information). From above, the body has a simple json object structure representing a person. Because the APIGatewayV2HTTPEvent defines the body as a string, the EventLoader fails with the following exception:
java.io.UncheckedIOException: com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (BufferedInputStream); line: 11, column: 11] (through reference chain: com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent["body"])
What am I missing here? Is this a deficiency in the EventLoader class, or am I attempting to test this behavior in the wrong way?
If you mean whether it is base64 encoded when I call through the API Gateway to the deployed version in AWS, no - I am logging the event from within the lambda and it shows isBase64Encoded: false
As a side note, the lambda works fine deployed to AWS - it is able to parse the input without problem. However, the EventLoader has problems in my unit test code when trying to replicate the event.
Activity
msailes commentedon Aug 7, 2023
When you use API Gateway and Lambda now, does the body come as base64 encoded?
bakerhaasis commentedon Aug 7, 2023
If you mean whether it is base64 encoded when I call through the API Gateway to the deployed version in AWS, no - I am logging the event from within the lambda and it shows
isBase64Encoded: falseAs a side note, the lambda works fine deployed to AWS - it is able to parse the input without problem. However, the EventLoader has problems in my unit test code when trying to replicate the event.