# Reference Cognito User Pool from Resource in Lambda Authorizer

**URL:** <https://forum.serverless.com/t/reference-cognito-user-pool-from-resource-in-lambda-authorizer/2581>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [August 27, 2017, 8:02pm UTC](https://forum.serverless.com/t/reference-cognito-user-pool-from-resource-in-lambda-authorizer/2581 "2017-08-27T20:02:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamclerk](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/adamclerk/32/933_2.png) [@adamclerk](https://forum.serverless.com/u/adamclerk)\
**Post date:** [August 27, 2017, 8:02pm UTC](https://forum.serverless.com/t/reference-cognito-user-pool-from-resource-in-lambda-authorizer/2581/1 "2017-08-27T20:02:32Z")

</div>

```
functions:
  authorized:
    handler: auth.authorized
    memorySize: 128
    timeout: 5
    events:
      - http:
          path: authorized
          method: get
          integration: lambda
          cors:
            origins:
              - '*'
          authorizer:
            arn: ${cf:my-project.userpoolarn}

...
resources:
  Outputs:
    ...
    UserPoolArn:
      Value:
        Fn::GetAtt: [myProjectUsrPool, Arn]
      Export:
        Name: 'userpoolarn'
    ...
  Resources:
    myProjectUsrPool:
      Type: AWS::Cognito::UserPool
      Properties:
        UserPoolName: MyProject-${self:provider.stage}-user-pool
        AutoVerifiedAttributes: 
          - email

```

Given the config. I’m getting the following error

```
Trying to request a non exported variable from CloudFormation. Stack name: "my-project" Requested variable: "userpoolarn".

```

Am I doing this wrong?

---

<div class="post-metadata">

**Author:** ![rowanu](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/rowanu/32/75_2.png) [@rowanu](https://forum.serverless.com/u/rowanu)\
**Post date:** [September 7, 2017, 9:51pm UTC](https://forum.serverless.com/t/reference-cognito-user-pool-from-resource-in-lambda-authorizer/2581/2 "2017-09-07T21:51:15Z")

</div>

You can’t reference an exported variable from the same service. Use [`Ref`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html) instead (with the JSON-style syntax).
