How to use jwks for auth0 jwt validation in Cloudflare workers

I am trying “jwt”-validation in Cloudflare workers.
This “jwt” is made by auth0.

My validation code as follow:

const jwt = require('jsonwebtoken');
const jwksRsa = require('jwks-rsa');
const util = require('util');

const jwksClient = jwksRsa({
  cache: true,
  rateLimit: true,
  jwksRequestsPerMinute: 5,
  jwksUri: `*****`
  });

const jwt_header = JSON.parse(new Buffer.from(id_token.split('.')[0], 'base64').toString());
const getSigningKey = util.promisify(jwksClient.getSigningKey);
const key = await getSigningKey(jwt_header.kid);

However, this code doesn’t work. (I am using wrangler dev for a test.)
The error which I got is
Uncaught (in promise)
TypeError: (t.adapter || s.adapter) is not a function
at t.exports (worker.js:12:357600)
Uncaught (in response)
TypeError: (t.adapter || s.adapter) is not a function

How can I fix it?

Hi, you probably want to take a look at https://github.com/signalnerve/workers-auth0-example . Hope that helps.