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 Resposta
0
profile picture
respondido há 2 meses
profile picture
ESPECIALISTA
avaliado há um mês
  • 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?

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas