# AWS API Gateway Custom Authorizers, error durring tutorial

**URL:** <https://community.auth0.com/t/aws-api-gateway-custom-authorizers-error-durring-tutorial/20523>\
**Category:** Get Help\
**Created:** [January 25, 2019, 8:25am UTC](https://community.auth0.com/t/aws-api-gateway-custom-authorizers-error-durring-tutorial/20523 "2019-01-25T08:25:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jojojmojo](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jojojmojo](https://community.auth0.com/u/jojojmojo)\
**Post date:** [January 25, 2019, 8:25am UTC](https://community.auth0.com/t/aws-api-gateway-custom-authorizers-error-durring-tutorial/20523/1 "2019-01-25T08:25:04Z")

</div>

Hello,  
I’m trying to create a custom authorizer per [Secure AWS API Gateway Endpoints Using Custom Authorizers - Auth0 Docs](https://auth0.com/docs/integrations/aws-api-gateway/custom-authorizers) and on part 3 when I run “npm test” I get the following error:

```
x:jwt-rsa-aws-custom-authorizer-master x$ npm test

> lambda-auth0-authenticator@0.1.0 test /Users/x/x/jwt-rsa-aws-custom-authorizer-master
> lambda-local --timeout 300 --lambda-path index.js --event-path event.json

info: START RequestId: 138cf1e8-b322-c2d1-b06d-44bd03080e15
{ type: 'TOKEN',
  authorizationToken: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni...lFVNGQ',
  methodArn: 'arn:aws:execute-api:ap-northeast-1:x:x/*/GET/' }
Error: options.uri is a required argument
    at Request.init (/Users/x/x/jwt-rsa-aws-custom-authorizer-master/node_modules/request/request.js:231:31)
    at new Request (/Users/x/x/jwt-rsa-aws-custom-authorizer-master/node_modules/request/request.js:127:8)
    at request (/Users/x/x/jwt-rsa-aws-custom-authorizer-master/node_modules/request/index.js:53:10)
    at JwksClient.getKeys (/Users/x/x/jwt-rsa-aws-custom-authorizer-master/node_modules/jwks-rsa/lib/JwksClient.js:84:29)
    at JwksClient.getSigningKeys (/Users/x/x/jwt-rsa-aws-custom-authorizer-master/node_modules/jwks-rsa/lib/JwksClient.js:102:12)
    at JwksClient.getSigningKey (/Users/x/x/jwt-rsa-aws-custom-authorizer-master/node_modules/jwks-rsa/lib/JwksClient.js:49:13)
    at /Users/x/x/jwt-rsa-aws-custom-authorizer-master/node_modules/jwks-rsa/lib/wrappers/rateLimit.js:29:16
    at afterTokensRemoved (/Users/x/x/jwt-rsa-aws-custom-authorizer-master/node_modules/limiter/lib/rateLimiter.js:87:7)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
info: End - Message
info: ------
info: Unauthorized: options.uri is a required argument
info: ------
info: Lambda successfully executed in 229ms.

```

Any help with this issue is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![chrisscott](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/chrisscott/32/11515_2.png) [@chrisscott](https://community.auth0.com/u/chrisscott)\
**Post date:** [March 4, 2019, 9:52pm UTC](https://community.auth0.com/t/aws-api-gateway-custom-authorizers-error-durring-tutorial/20523/2 "2019-03-04T21:52:57Z")

</div>

That error occurs when the `JWKS_URI` environment variable isn’t set. Make sure you’ve followed [step 3 in part 3](https://auth0.com/docs/integrations/aws-api-gateway/custom-authorizers/part-3#prepare-the-custom-authorizer) and created a `.env` file with all three variables set–if you’re logged in to the docs site then your current tenant values will be supplied and you will only need to edit `AUDIENCE` to match what you set when creating the API in Auth0.

---

<div class="post-metadata">

**Author:** ![douglas.mcgowan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/douglas.mcgowan/32/12826_2.png) [@douglas.mcgowan](https://community.auth0.com/u/douglas.mcgowan)\
**Post date:** [March 13, 2019, 6:44am UTC](https://community.auth0.com/t/aws-api-gateway-custom-authorizers-error-durring-tutorial/20523/3 "2019-03-13T06:44:35Z")

</div>

Hi All,

Just an FYI, I had this exact same issue when I attempted to test the lambda once actually loaded into AWS. Issue was the .env file wasn’t included in the npm run bundle. Once added it worked.

Is the .env file meant to be excluded from the bundle and these parameters get provided by other means? Or should the .env file be there?

Regards,  
Doug.

---

<div class="post-metadata">

**Author:** ![mhopey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mhopey/32/13994_2.png) [@mhopey](https://community.auth0.com/u/mhopey)\
**Post date:** [March 29, 2019, 6:59pm UTC](https://community.auth0.com/t/aws-api-gateway-custom-authorizers-error-durring-tutorial/20523/4 "2019-03-29T18:59:15Z")

</div>

If you explicitly set these 3 variables in the lambda function “Environment Variables” section it should work.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 15, 2019, 1:05pm UTC](https://community.auth0.com/t/aws-api-gateway-custom-authorizers-error-durring-tutorial/20523/5 "2019-04-15T13:05:24Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
