Validating JWT in Cloudflare Pages (CF's tutorial doesn't work when deployed)

I'm following https://developers.cloudflare.com/cloudflare-one/identity/authorization-cookie/validating-json/ (JavaScript). I understand it's for Express, but I've removed the Express parts and adjusted it for SvelteKit to be deployed in Cloudflare Pages. But when deploying I got this error:
22:06:07.363 > Using @sveltejs/adapter-cloudflare
22:06:07.427 ✘ [ERROR] Could not resolve "http"
22:06:07.427
22:06:07.427 node_modules/.pnpm/[email protected]/node_modules/jwks-rsa/src/wrappers/request.js:1:21:
22:06:07.427 1 │ const http = require('http');
22:06:07.427 ╵ ~~~~~~
22:06:07.428
22:06:07.428 Cannot use "http" when deploying to Cloudflare.
22:06:07.363 > Using @sveltejs/adapter-cloudflare
22:06:07.427 ✘ [ERROR] Could not resolve "http"
22:06:07.427
22:06:07.427 node_modules/.pnpm/[email protected]/node_modules/jwks-rsa/src/wrappers/request.js:1:21:
22:06:07.427 1 │ const http = require('http');
22:06:07.427 ╵ ~~~~~~
22:06:07.428
22:06:07.428 Cannot use "http" when deploying to Cloudflare.
According to https://github.com/cloudflare/workers-sdk/issues/3351 and https://community.cloudflare.com/t/possible-to-set-node-compat-on-pages-functions/448593, they're simply not supported. What should I do?
1 Reply
TW
TWOP8mo ago
Updated the question for clarity
Want results from more Discord servers?
Add your server