Open ningji opened 1 year ago
yarn 1.22.19 node 16.16.0 MacOS Ventura
Running into the same issue. Is there any update on this or how to mitigate this?
@b-smets I just got this as well after an npm install. Timing-wise it feels as if we have some library which have upgraded it's dependency hitting a dormant bug here?
I did some more digging and I think this is caused by Vite externalising stream
which causes DataStream to become a Proxy with an undefined prototype. Probably it will work when polyfilling stream
in the browser.
Can confirm that running with the https://www.npmjs.com/package/vite-plugin-node-polyfills plugin, the issue no longer occurs. I suppose the same can be done for other bundlers if required.
This doesn't seem to be an issue with node-jws itself.
Thanks for the hint!
I'm using webpack 5 through create-react-scripts with react-app-rewired. Adding the stream polyfill did the resolve the issue for me.
When migrating my app from react 17 to 18, got this in chrome when starting my app.
Uncaught runtime errors: × ERROR Object prototype may only be an Object or null: undefined TypeError: Object prototype may only be an Object or null: undefined at Function.create ()
at Object.inherits (http://localhost:3010/static/js/bundle.js:62529:31)
at ./node_modules/jws/lib/data-stream.js (http://localhost:3010/static/js/bundle.js:66271:6)
at options.factory (http://localhost:3010/static/js/bundle.js:230212:31)
at webpack_require__ (http://localhost:3010/static/js/bundle.js:229657:33)
at fn (http://localhost:3010/static/js/bundle.js:229869:21)
at ./node_modules/jws/lib/sign-stream.js (http://localhost:3010/static/js/bundle.js:66295:18)
at options.factory (http://localhost:3010/static/js/bundle.js:230212:31)
at webpack_require__ (http://localhost:3010/static/js/bundle.js:229657:33)
at fn (http://localhost:3010/static/js/bundle.js:229869:21)
There're plenty of changes i made to migrate to react 18, so not very sure which one caused the issue. I'll update more info if i find out more, but this is the most of the package.json (except our internal libs). Any help appreciated.