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개 답변
0
profile picture
답변함 2달 전
profile picture
전문가
검토됨 한 달 전
  • 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?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠