无法在 API Gateway Cloudformation 中设置 Cognito 用户池 AuthorizerId

Cognito User Pool AuthorizerId cannot be set in API Gateway Cloudformation

我成功部署了一个 Cognito 用户池,并使用它根据我设置的方法进行身份验证,以代理到 API 网关中的 API,现在我正在创建一个 Cloudformation 模板同一个堆栈。使用 Cloudformation,我设置了 API 网关和使用我的用户池的授权方。工作正常。当我尝试部署使用授权方的方法时,它失败了:

Invalid authorizer ID specified. Setting the authorization type to CUSTOM
or COGNITO_USER_POOLS requires a valid authorizer.

这是 Cloudformation 堆栈的相关部分:

TestMethod:
  Type: AWS::ApiGateway::Method
  Properties:
    RestApiId: !Ref RestApi
    ResourceId: !Ref TestResource
    HttpMethod: POST      
    AuthorizationType: COGNITO_USER_POOLS
    AuthorizerId: !Ref ApiAuthorizer
    Integration:
      Type: HTTP_PROXY
      IntegrationHttpMethod: POST
      Uri: https://api.example.com/test

ApiAuthorizer: 
  Type: "AWS::ApiGateway::Authorizer"
  Properties: 
    AuthorizerResultTtlInSeconds: 300
    IdentitySource: method.request.header.Authorization
    Name: CognitoDefaultUserPoolAuthorizer
    ProviderARNs: 
      - !ImportValue DefaultUserPool::Arn
    RestApiId: !Ref RestApi
    Type: "COGNITO_USER_POOLS"

Authorizer 部署良好,我可以在 Cloudformation 中看到它的 ID,并且该方法在没有添加授权的情况下部署良好。如果我直接声明 ID 而不是引用 Authorizer,也会出现同样的问题。

Cloudformation 的 Authorizer docsRef! 应该 return ID,所以我真的很困惑这里发生了什么。

对我来说似乎是一个错误,但也许我遗漏了什么?

AWS 现已修复此问题。它按照我最初发布的示例工作。