Lambda Authorizer and APIGatewayCustomAuthorizerContextOutput Problem

20 views Asked by At

In our C# Lambda Authorizer, we return an APIGatewayCustomAuthorizerResponse (obviously). One of the properties of the APIGatewayCustomAuthorizerResponse is the Context property which is of type APIGatewayCustomAuthorizerContextOutput. We want to use the Context property in the Authorizer Lambda to communicate with the "API Lambda" that the Authorizer sits in front of.

The problem is that even though APIGatewayCustomAuthorizerContextOutput extends Dictionary<String, Object> you cannot put Object values in the Context. You must have only String values in the Dictionary.

In the CloudWatch logs for the API Gateway, this is an error I see when I use Object values:

Execution failed due to configuration error: Invalid JSON in response: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)

Why does APIGatewayCustomAuthorizerContextOutput extend Dictionary<String, Object> if I cannot use real Object values?

0

There are 0 answers