Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AwsProxyResponse class is generating response JSON which is rejected by API gateway with Malformed error #884

Open
Chiranjibeem opened this issue May 9, 2024 · 3 comments

Comments

@Chiranjibeem
Copy link

We are calling java lambda from api gateway and in cloudwatch logs i can see internal server error is coming,

After going through the logs and support team i got to know that AwsProxyResponse class is generating response JSON which is rejected by API gateway with Malformed error

Json generated is using field name base64Encoded instead of isBase64Encoded

@deki
Copy link
Collaborator

deki commented May 9, 2024

Hi @Chiranjibeem,
can you please fill out the issue template to help us looking into your issue?
The property is named explicitly
https://github.com/aws/serverless-java-container/blob/main/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/model/AwsProxyResponse.java#L122 so I wonder what makes the serialization ignore it in your case.

To help us debug your issue fill in the basic information below using the options provided

Serverless Java Container version: eg. 1.5

Implementations: Jersey / Spring / Spring Boot / Spring Boot 2 / Spark

Framework version: eg SpringBoot 2.2.6.RELEASE

Frontend service: REST API / HTTP API / ALB

Deployment method: eg SAM, Serverless Framework, Console

Scenario

Describe what you are trying to accomplish

Expected behavior

Describe how you would expect the application to behave

Actual behavior

Describe what you are seeing instead

Steps to reproduce

Provide code samples we can use to reproduce the issue as part of our integration tests. If there is a public repository for the misbehaving application link to it here

Full log output

Paste the full log output from the Lambda function's CloudWatch logs

logs

@Chiranjibeem
Copy link
Author

Serverless Java Container version: 2.0.0-M2

Implementations: Spring Boot

Framework version: SpringBoot 3.2.0

Frontend service: AWS API Gateway

Deployment method: Serverless Framework

Scenario - When we are trying to invoke lambda with proxy integration from apigateway, apigateway is throwing malformed error

Expected Behaviour - as part of lambda response, api gatway is expecting isBase64Encoded value but from lambda response we are getting only base64Encoded key

Actual Behaviour - isBase64Encoded should come ans statusDescriptions also not required as per api gateway

Stepa to reproduce -
Create a api gatway
Call lambda ( rerurn type should be AwsProxyResponse)
Invoke Lambda from ApIGAteway

@deki
Copy link
Collaborator

deki commented May 10, 2024

Can you please try reproducing it using our sample https://github.com/aws/serverless-java-container/tree/main/samples/springboot3/pet-store?

We have multiple unittests in place that cover it so I can only imagine it's related to specific configurations inside your application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants