JsonMappingException for aws api gateway custom authorizer


This Content is from Stack Overflow. Question asked by Makarand Deshpande

I am using aws lambda authorizer with api gateway.My handler is written in Java
While returning IAM policy document getting json mapping exeception ,
attaching the screenshot of logs from cloudwatch , I have also logged the handler response pojo you can check in the screenshot.

cloudwatch logs image

However , If I test lambda output it is giving correct json as expected
but it is breaking when I hit the same function through api gateway , Please suggest
any help would be appreciated.

"policyDocument": {
 "Version": "2012-10-17",
 "Statement": [
     "Action": "execute-api:Invoke",
     "Effect": "Allow",
     "Resource": "arn:aws:execute-api:us-east-1:304262502320:uz4gxmilu8/Test/GET/*"
"context": {
 "sub": "auth"


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?