0
votes

I'm trying to setup simple authorizer based on this doc. Also using serverless plugin serverless-pseudo-parameters.

My serverless configuration for authorizer:

provider:
...
  logs:
    httpApi: true
  httpApi:
    cors: true
    authorizers:
      simpleAuthorizer:
        identitySource: $request.header.Authorization
        issuerUrl:
          - Fn::Join:
              - '/'
              - - https://cognito-idp.#{AWS::Region}.amazonaws.com
                - "#{CognitoUserPool}"
        audience:
          - "#CognitoUserPoolClient"

My configuration for simple lambda:

functions:
  ping:
    name: ${self:provider.stage}-ping
    handler: test.handler
    events:
      - httpApi:
          method: GET
          path: /test
          authorizer:
            name: simpleAuthorizer

My configuration of user pool and user pool client:

resources:
  Resources:
    CognitoUserPool:
      Type: AWS::Cognito::UserPool
      Properties:
        UserPoolName: ${self:service}-${self:provider.stage}-user
        UsernameAttributes:
          - email
        Policies:
          PasswordPolicy:
            MinimumLength: 6
            RequireLowercase: False
            RequireNumbers: True
            RequireSymbols: False
            RequireUppercase: True
        Schema:
          - Name: email
            Required: false
            DeveloperOnlyAttribute: false
            Mutable: true
            AttributeDataType: String

    CognitoUserPoolClient:
      Type: AWS::Cognito::UserPoolClient
      Properties:
        ClientName: cognito-example-client
        GenerateSecret: False
        UserPoolId: "#{CognitoUserPool}"

User pool, user pool client, HTTP API, lambda successfully created, but I can't see a authorizer at the AWS console of API Gateway service.

1

1 Answers

0
votes

So, the problem has simple solution: just update your serverless (I used 1.63.0 which gave me this problem).