node-auth0 icon indicating copy to clipboard operation
node-auth0 copied to clipboard

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

Open emmanuelgautier opened this issue 1 year ago • 3 comments

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 avatar Aug 02 '24 21:08 emmanuelgautier

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 avatar Apr 01 '25 04:04 mhart

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

mhart avatar Apr 01 '25 04:04 mhart

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?

emmanuelgautier avatar Apr 03 '25 10:04 emmanuelgautier