I followed the tutorial at Auth0 Node (Express) API SDK Quickstarts: Authorization and created the middleware
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: 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!