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
エキスパート
レビュー済み 1ヶ月前
  • 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?

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ