Stage variable works for REST api Lambda authorizer but not for HTTP api Lambda authorizer

0

We have an HTTP API with prod and test stages. We defined a stage variable key = 'suffix' and value = '-test' for the test stage.

We want to use a Lambda function as the authorizer. So we created one Lambda function apiGatewayHTTPAuthorizer for prod stage and another function apiGatewayHTTPAuthorizer-test for the test stage.

I used the stage variable like apiGatewayHTTPAuthorizer${stageVariables.suffix} to attach the authorizer in the HTTP API. But I got "internal server error" when I tested the API. In the API log, there's authorizerError (see attached). When I checked the log of Lambda function apiGatewayHTTPAuthorizer-test, there's no invocation. Seems API gateway didn't translate the ${stageVariables.suffx} to the value we defined.

Enter image description here

However, the stage variable works for the REST API authorizer.

How can we make it work for the HTTP API?

1 Respuesta
0
profile picture
respondido hace 2 meses
profile picture
EXPERTO
revisado hace un mes
  • Hi, it seems that the Lambda authorizer function wasn't invoked at all because I couldn't find the invocation record in the Lambda log. Seems the API Gateway didn't use the stage variable when invoking the Lambda authorizer. Is this a bug in HTTP API gateway?

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas