【问题标题】:API GW V2 HTTP API and legacy lambda authorizerAPI GW V2 HTTP API 和旧版 lambda 授权器
【发布时间】:2021-02-17 15:19:01
【问题描述】:

我正在尝试将 API GW v2 HTTP API 与旧版(有效负载版本 1.0)自定义 lambda 授权器集成。它能够调用自定义 lambda 授权程序,但在网关日志中低于响应 ($context.authorizer.error),状态为 500 ($context.authorizer.status https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging-variables.html)-

The response from the Lambda Authorizer function doesn't match the format that API Gateway expects. Invalid value for 'context'

这表明它不遵守此处提到的响应格式- https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html#http-api-lambda-authorizer.payload-format-response

但同样的旧版 lambda 可以在 API GW v1 REST API 上正常工作。也无法启用像 REST API 这样的执行日志,因此如果它没有返回正确的响应,则无法看到 lambda 返回的实际响应,但我对此表示怀疑。

【问题讨论】:

    标签: aws-lambda aws-api-gateway


    【解决方案1】:

    所以问题似乎是 API GW HTTP API 不喜欢来自 Lambda 授权方的上下文变量中的空值。现在要抑制空值,但理想情况下 API GW 应该优雅地处理空值。另一个问题是,如果 Lambda 授权方花费的时间超过 10 秒,但无法为 lambda 授权方配置超时,它似乎会超时。

    【讨论】:

      猜你喜欢
      • 2021-09-04
      • 2012-11-28
      • 2019-07-04
      • 1970-01-01
      • 1970-01-01
      • 2012-11-21
      • 1970-01-01
      • 1970-01-01
      • 2017-04-13
      相关资源
      最近更新 更多