Node.js API used in jose/dist/browser/runtime/env.js on line 6
See original GitHub issueWhat happened?
I am using Jose in combination with Next.js (v12.2) middleware and an error is thrown due to process.versions
being used inside jose/dist/browser/runtime/env.js
on line 6.
I suppose it could be replaced with simply checking typeof process === 'object
to find out if it’s node, since the only thing done in this file is to check if it’s run inside node.
Version
4.18.1
Runtime
Browser
Runtime Details
Next.js (v12.2) middleware / only browser api available
Code to reproduce
Create a project with Next.js v12.2 and add import * as jose from 'jose'
inside a middleware defined according to: https://nextjs.org/docs/advanced-features/middleware
Required
- I have searched the issues tracker and discussions for similar topics and couldn’t find anything related.
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Node-API | Node.js v19.3.0 Documentation
Node -API (formerly N-API) is an API for building native Addons. It is independent from the underlying JavaScript runtime (for example, V8) and...
Read more >Node.js v19.3.0 Documentation
Creates a new CallTracker object which can be used to track if functions were called a specific number of times. The tracker.verify() must...
Read more >Command-line API | Node.js v19.3.0 Documentation
Command-line API#. Node.js comes with a variety of CLI options. These options expose built-in debugging, multiple ways to execute scripts, and other helpful ......
Read more >Process | Node.js v19.3.0 Documentation
The --trace-warnings command-line option can be used to have the default console output for warnings include the full stack trace of the warning....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@leerob @balazsorban44 how do you envision universal libraries doing runtime detection?
This here seems like a regression in Next.js. I think if it were to first do a typeof check on the process global and then continue off to access the versions and node properties it would still not allow these developers’ apps to run in 12.2 which ran just fine before
v4.8.3
will be released shortly (pending CI) with the code frommain
which coincidentally removed the need for this anyway.I’ll leave this open as https://github.com/panva/jose/labels/triage so that @leerob @balazsorban44 can pitch in.