-
Notifications
You must be signed in to change notification settings - Fork 298
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
Adapt Remix package to run on Cloudflare Workers #127
Comments
Thanks for reporting that. A ticket for this issue already exists, so let me get back at you once the fix is deployed - will probably happen soon enough :) |
Hey @MedicusIO :) |
After much soul searching I switched to Fly.IO which runs node (so this is less of an issue to me now). Cloudflare workers run V8 so anything that runs in the browser runs in a worker. The upside is there is no cold start like with lambda. However, you cannot use any node packages which is limiting. |
I've encountered this too I think, even just trying to run miniflare with Clerk doesn't seem to work. I'm guessing it's because of Clerk only because of this error:
If I search through all the packages in the project for the ones that use http-wrapper, the only one I get is one called "got", which is used in Clerk-node. I'll try and put together a simple reproduction case but it might take until this weekend. |
Thanks peeps, it would be really helpful for us to start checking the issue based on the setup and give you a resolution. |
Found five minutes this morning and it was actually easier than I thought to reproduce. This is a fresh remix repo with Cloudflare workers set as the deployment target, I've added Clerk's root auth loader, nothing else. If you try to run this, it won't work. If you remove the two lines for Clerk from root.tsx it works. Hope that's helpful. |
|
any update here? |
Still working on it. The latest status is that we need to find an isomorphic HTTP clients and an isomorphic crypto library. The HTTP client we picked for now is cross-fetch. Things are a bit trickier in the crypto world. |
Thanks for the update! Not sure if this helps, but CF workers implements the web crypto api and there seems to be something similar to cross-fetch for that use case. https://www.npmjs.com/package/isomorphic-webcrypto There also seems to be support for the web crypto API in node directly but the earliest LTS with support seems to be 16 |
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
+1 this is also blocking me. Anything we can do to help speed up the process? |
According to MDN, it's supported from v15. |
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
Folks, this is the first PR towards a more isomorphic architecture #290. It's still WIP as I am currently on paternity leave but the direction should be clear. Let us know what you think. |
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
@SokratisVidros any updates or any way to help speed up the process? |
There's https://github.com/sindresorhus/ky-universal by the same people who created got. |
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
Hey @marcus-sa, the PR introducing fetch will be merged later this week. The next step is to bump to Node 16 and use webcrypto. Apologies this is taking longer than expected but more pressuring tasks came up as we are in the process of releasing ClerkJS V4 with brand new components. |
Polyfill global.fetch only in Node environments if necessary and increase interoperability for the SDK across Node and V8 runtime environments. Fixes #127
The first PR about fetch is now merged. Next week we will replace Node crypto with Web crypto. |
Any update on this? Would be good to be finally able use Clerk with Remix and CF Pages. 🙏 |
Apologies for the delay. We are currently working to support Next.js 12.2 Middleware. Cloudflare workers for Remix and other frameworks are next on the list. |
Is there any sort of timeline that we could refer to? |
We expect this to be resolved in November. As you can see in https://github.com/clerkinc/javascript/pull/460/files we've started rearchitecting our backend SDKS to make them work across web-interoperable runtimes. |
@SokratisVidros May I know the status of this ? Is the support for Remix on Cloudflare workers is still experimental ? |
@dimkl Thank you for tagging this to my comment but I am afraid and believe that these are not related. The document on your website clearly states that Edge runtime including Cloudflare Workers is supported I am not sure if this ticket is still valid. Please kindly help this is a huge blocker for the work which I have planned. Thank you so much in advance. |
I am currently using Clerk plus Cloudflare Pages so I believe this can be closed |
Yes, Remix is fully supported across all runtimes. |
@aerojeyenth your issue is not related to this. i will reopen the previous issue. |
Package
@clerk/clerk-js
@clerk/clerk-react
@clerk/nextjs
@clerk/remix
@clerk/clerk-expo
@clerk/backend-core
@clerk/clerk-sdk-node
@clerk/edge
Description
The rootAuthLoader uses http2 which is a node package. Cloudflare Workers does not have access to Node.js packages, just plain javascript. Can this not be changed to fetch?
The text was updated successfully, but these errors were encountered: