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 Answer
0
  • 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?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions