panva / openid-client

OAuth 2 / OpenID Connect Client API for JavaScript Runtimes
MIT License
1.83k stars 392 forks source link

Jose Update required? #472

Closed BirknerAlex closed 2 years ago

BirknerAlex commented 2 years ago

Describe the bug

Trying to build openid-client on Cloudflare Workers inside a NuxtJS 3 SSR application but it fails with the following error:

alexander:website$ wrangler dev
🌀  Running NITRO_PRESET=cloudflare yarn nuxt build
yarn run v1.22.17
$ website/node_modules/.bin/nuxt build
Nuxt CLI v3.0.0-27415326.3c563fa                                                                                                                                                                                                                                                16:54:20: Vite warmed up in 911ms                                                                                                                                                                                                                                                       16:54:21:  Client built in 6792ms                                                                                                                                                                                                                                                        16:54:28:  Building server...                                                                                                                                                                                                                                                            

✔ Server built in 2323ms 
ℹ Nitro preset is cloudflare 
ℹ Cleaning up .output       
start Generating public...      
✔ Generated public .output/public     
Building server...                   

 ERROR  Rollup error: 'randomFillSync' is not exported by node_modules/unenv/runtime/mock/proxy.mjs, imported by node_modules/jose/dist/node/esm/runtime/random.js

 ERROR  'randomFillSync' is not exported by node_modules/unenv/runtime/mock/proxy.mjs, imported by node_modules/jose/dist/node/esm/runtime/random.js

Jose natively supports Cloudflare Workers but it seems it requires Jose 5 instead of 4, openid-client requires Jose 4 at the moment.

Building NuxtJS 3 without Cloudflare Workers preset works fine.

Expected behaviour

openid-client works on Cloudflare Workers.

Environment:

Additional context Add any other context about the problem here.

panva commented 2 years ago

openid-client does not support runtimes other than Node.js

https://github.com/panva/node-openid-client#faq