Skip to content

fix: makes node version undefined when process.version is undefined #1027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

emmanuelgautier
Copy link

@emmanuelgautier emmanuelgautier commented Aug 2, 2024

Changes

Makes node version undefined when process.version is undefined. process.version can be undefined on some edge runtimes like cloudflare workers.

References

Testing

  1. Create a Node.js worker
  2. Instantiate an Auth0 client and perform a request with this client

Expected: No error should be thrown.

Checklist

@emmanuelgautier emmanuelgautier requested a review from a team as a code owner August 2, 2024 21:03
@emmanuelgautier emmanuelgautier requested a review from a team as a code owner August 29, 2024 09:47
@mhart
Copy link

mhart commented Apr 1, 2025

Would also be nice to bump the jose dep too because of this line in v4: https://github.com/panva/jose/blob/051a18e13c9df98d0cfb7d9a7cca7f3746f23526/src/runtime/node/flags.ts#L1

My reading of the jose changelog suggests that v5 still supports Node.js 18, so I think it should be fine for a patch release of this library.

@mhart
Copy link

mhart commented Apr 1, 2025

Btw, you can define these variables if you're using Cloudflare Workers.

Add this (or similar) to your wrangler.jsonc:

  "define": {
    "process.version": "\"v22.14.0\"",
    "process.versions": "{ \"node\": \"22.14.0\" }"
  },

And then these values will get injected at build time

@emmanuelgautier
Copy link
Author

Would also be nice to bump the jose dep too because of this line in v4: https://github.com/panva/jose/blob/051a18e13c9df98d0cfb7d9a7cca7f3746f23526/src/runtime/node/flags.ts#L1

My reading of the jose changelog suggests that v5 still supports Node.js 18, so I think it should be fine for a patch release of this library.

Yes, a JOSE update would be nice too. Perhaps in a separate PR?
This PR has been open for 9 months now, so I’d prefer to get it merged first to address this issue quickly.

@tusharpandey13 @tanya732 Could someone review this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants