# Express-oauth2-jwt-bearer JWT.io issue

**URL:** <https://community.auth0.com/t/express-oauth2-jwt-bearer-jwt-io-issue/130736>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [March 28, 2024, 4:03pm UTC](https://community.auth0.com/t/express-oauth2-jwt-bearer-jwt-io-issue/130736 "2024-03-28T16:03:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pytest3](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pytest3/32/55977_2.png) [@pytest3](https://community.auth0.com/u/pytest3)\
**Post date:** [March 28, 2024, 4:03pm UTC](https://community.auth0.com/t/express-oauth2-jwt-bearer-jwt-io-issue/130736/1 "2024-03-28T16:03:01Z")

</div>

I followed the tutorial at [Auth0 Node (Express) API SDK Quickstarts: Authorization](https://auth0.com/docs/quickstart/backend/nodejs/01-authorization) and created the middleware

```auto
const checkJwt = auth({
  audience: process.env.AUDIENCE_ID,
  issuerBaseURL: process.env.ISSUER_BASE_URL,
});

```

However, I get the error: AssertionError [ERR\_ASSERTION] when trying to deploy to [fly.io](http://fly.io): You must provide an ‘issuerBaseURL’, an ‘issuer’ and ‘jwksUri’ or an ‘issuer’ and ‘secret’

Logs below:

2024-03-28T15:39:13Z app[683d612b77de78] sin [info]\> test-express@1.0.0 deploy  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info]\> NODE\_ENV=production node index.js  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info]node:assert:399  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] throw err;  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] ^  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info]AssertionError [ERR\_ASSERTION]: You must provide an ‘issuerBaseURL’, an ‘issuer’ and ‘jwksUri’ or an ‘issuer’ and ‘secret’  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] at jwtVerifier (/app/node\_modules/express-oauth2-jwt-bearer/dist/index.js:264:12)  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] at auth (/app/node\_modules/express-oauth2-jwt-bearer/dist/index.js:399:23)  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] at Object. (/app/index.js:31:18)  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] at Module.\_compile (node:internal/modules/cjs/loader:1241:14)  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] at Module.\_extensions…js (node:internal/modules/cjs/loader:1295:10)  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] at Module.load (node:internal/modules/cjs/loader:1091:32)  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] at Module.\_load (node:internal/modules/cjs/loader:938:12)  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run\_main:83:12)  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] at node:internal/main/run\_main\_module:23:47 {  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] generatedMessage: false,  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] code: ‘ERR\_ASSERTION’,  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] actual: undefined,  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] expected: true,  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info] operator: ‘==’  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info]}  
2024-03-28T15:39:13Z app[683d612b77de78] sin [info]Node.js v20.7.0  
2024-03-28T15:39:14Z app[683d612b77de78] sin [info] INFO Main child exited normally with code: 1  
2024-03-28T15:39:14Z app[683d612b77de78] sin [info] INFO Starting clean up.  
2024-03-28T15:39:14Z app[683d612b77de78] sin [info] INFO Umounting /dev/vdb from /data  
2024-03-28T15:39:14Z app[683d612b77de78] sin [info][2.359808] reboot: Restarting system

Please help!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [April 1, 2024, 8:28pm UTC](https://community.auth0.com/t/express-oauth2-jwt-bearer-jwt-io-issue/130736/3 "2024-04-01T20:28:17Z")

</div>

Hey there @pytest3 welcome to the community!

While I can’t speak to deploying to [fly.io](http://fly.io), configuring the sample to my own environment and running/testing locally seems to be working as expected. Are you able to test the sample locally and confirm?

> [@pytest3](#):
>
> ```auto
> const checkJwt = auth({
> audience: process.env.AUDIENCE_ID,
> issuerBaseURL: process.env.ISSUER_BASE_URL,
> });
> 
> ```

FWIW, if you have the `audience` and `issuer_base_url` values defined in your `.env` the `auth()` function should retrieve those for you [automatically](https://github.com/tyfrth/auth0-express-api-samples/blob/81d86ff402b4992d462301cee189f3be3aed0d6c/01-Authorization-RS256/server.js#L17).

Are you positive you have `require('dotenv').config();` in your own code? The error to me looks like the `issuer_base_url` isn’t getting set correctly.

---

<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, 2024, 8:28pm UTC](https://community.auth0.com/t/express-oauth2-jwt-bearer-jwt-io-issue/130736/4 "2024-04-15T20:28:51Z")

</div>

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