-
Notifications
You must be signed in to change notification settings - Fork 310
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
Support edge runtime #996
Comments
I'm having the same issue with Cloudflare Workers. Even though Cloudflare Workers expose certain parts of the Node runtime, they need to be imported like so:
Whether this has any further implications, I'm not sure. I'm considering forking this repo and pushing my own package. |
Would love to see this, running in to the same issue on Vercel's Edge runtime.
In the meantime, could you share how you patched the package to fix it? |
Sure, here's my patchfile: diff --git a/dist/cjs/utils.js b/dist/cjs/utils.js
index b616a65f9535b8836a8521d44315811b12e2b959..9614a1452ff37ff0654f1375802bfe5d08b144c5 100644
--- a/dist/cjs/utils.js
+++ b/dist/cjs/utils.js
@@ -9,7 +9,7 @@ const generateClientInfo = () => ({
name: 'node-auth0',
version: version_js_1.version,
env: {
- node: process.version.replace('v', ''),
+ node: typeof EdgeRuntime === 'string' ? 'Edge' : process.version.replace('v', ''),
},
});
exports.generateClientInfo = generateClientInfo;
diff --git a/dist/esm/utils.js b/dist/esm/utils.js
index f9774bdcceeaa2597199fff97b644d104cccfbc0..e10824ecc61864340f966c06bdc57c167e1d7bbd 100644
--- a/dist/esm/utils.js
+++ b/dist/esm/utils.js
@@ -6,7 +6,7 @@ export const generateClientInfo = () => ({
name: 'node-auth0',
version: version,
env: {
- node: process.version.replace('v', ''),
+ node: typeof EdgeRuntime === 'string' ? 'Edge' : process.version.replace('v', ''),
},
});
//# sourceMappingURL=utils.js.map |
This snippet works fine for me waiting a better fix to be merged. // @ts-ignore
process.version = 'cloudflare'
const client = new ManagementClient({
...
}) |
Checklist
Describe the problem you'd like to have solved
This library is not compatible with Vercel's edge runtime (haven't tested others) due to this line:
https://github.com/auth0/node-auth0/blob/master/src/utils.ts#L10
Describe the ideal solution
This library to support the edge runtime
Alternatives and current workarounds
Patch the package to not use
node.version
.Additional context
No response
The text was updated successfully, but these errors were encountered: