# Adding a second authorizer of type COGNITO\_USER\_POOL fails

**URL:** <https://forum.serverless.com/t/adding-a-second-authorizer-of-type-cognito-user-pool-fails/8034>\
**Category:** Serverless Framework\
**Created:** [April 19, 2019, 4:48pm UTC](https://forum.serverless.com/t/adding-a-second-authorizer-of-type-cognito-user-pool-fails/8034 "2019-04-19T16:48:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoop](https://avatars.discourse-cdn.com/v4/letter/h/ad7895/32.png) [@hoop](https://forum.serverless.com/u/hoop)\
**Post date:** [April 19, 2019, 4:48pm UTC](https://forum.serverless.com/t/adding-a-second-authorizer-of-type-cognito-user-pool-fails/8034/1 "2019-04-19T16:48:01Z")

</div>

I’m relatively new to the serverless framework. I want to grant access to my endpoints via a cognito user pool. I’ve created the user pool in the AWS console directly. I then deployed my function for the corresponding end point and added the authorizer in the console too.

Afterwards I’ve added the following authorizer snippet to my serverless.yml file:

```
functions:
  test1:
    handler: handler.test1
    events:
      - http:
          path: /test1
          method: post 
          integration: lambda
          request:
            template:
              application/json: "$input.json('$')"
          response:
            headers:
              Content-Type: "'application/json'"
          authorizer:
            arn: arn:YYYYYYYYYY:XXXXXXXXXXXXXXXX

```

It looks like my end point is still working correctly, using the cognito pool for access. I then added a second endpoint where I wanted to define everything in the serverless.yml in the first place. So I’ve added this snippet to the function section

```
  test2:
    handler: handler.test2
    events:
      - http:
          path: /test2
          method: post 
          integration: lambda
          request:
            template:
              application/json: "$input.json('$')"
          response:
            headers:
              Content-Type: "'application/json'"
          authorizer:
            arn: arn:YYYYYYYYYY:XXXXXXXXXXXXXXXX

```

Using the same user pool arn as for method `test1`. However, this result in an error when I try to deploy:

`An error occurred: ApiGatewayMethodTest2Post - Invalid authorizer ID specified. Setting the authorization type to CUSTOM or COGNIT_USER_POOLS requires a valid authorizer.`

Now I’m asking myself two questions:

1. Why isn’t it working for `test2`

2. How to use existing user pool for granting access to gateway endpoints?
