Skip to content

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

Open

Description

@Chiranjibeem

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

Activity

  1. deki commented on May 9, 2024

    @deki
    Contributor

    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
    
  2. Chiranjibeem commented on May 9, 2024

    @Chiranjibeem
    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

  3. deki commented on May 10, 2024

    @deki
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions