0

Created Java authorizer lambda to validate token. When I deploy aws jar works as expected, getting iampolicy as response. When Created native image using graalvm to minimize cold start time the response is changed to APIGatewayProxyResponseEvent. Got to know from API gateway logs getting below exception

 Execution failed due to configuration error: Invalid JSON in response: Unrecognized field "isBase64Encoded" , not marked as ignorable  

As it is expecting iampolicy as a response from authorizer instead it got below response.

{
    "isBase64Encoded": false,
    "headers": {
        "date": "Tue, 09 Aug 2022 10:53:00 GMT",
        "transfer-encoding": "chunked",
        "lambda-runtime-trace-id": "",
        "aws-api-gateway": "true",
        "lambda-runtime-aws-request-id": "99b3-c10da8d41cfb",
        "id": "339781a6-535f-dc19-e079-f32ae48a742c",
        "contentType": "application/json",
        "lambda-runtime-invoked-function-arn": "arn",
        "lambda-runtime-deadline-ms": "1660042443373",
        "timestamp": "1660042380735"
    },
    "body": "{\"principalId\":\"principleId\",\"policyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"execute-api:Invoke\",\"Effect\":\"Allow\",\"Resource\":\"arn:resource\"}]},\"context\":{\"sub\":\"SamplecontextObject\"}}",
    "statusCode": 200
}

Please any input/suggestion will be helpful

shiva789
  • 11
  • 2
  • you can ignore unknown by using JsonIgnoreProperties check https://stackoverflow.com/a/5455563/175554 – ozkanpakdil Aug 26 '22 at 07:10
  • Thank you for the response, in this case lambda is returing IamPolicy response [which is present in the body part] works as expected if i upload code as jar to lambda, but when application is converted to native executable using spring native the response is getting wrapped as APIGatewayProxyResponseEvent. – shiva789 Aug 28 '22 at 14:48
  • @shiva789 Did you find the solution for this problem. I am also having the same, so would be happy if you could share update on this :) – Arpit May 20 '23 at 03:54

0 Answers0