Has anyone been able to use cloudflare durable objects successfully with react-router 7 in framework mode? #12565
-
Everything I try seems to not allow binding durable objects, at least not in development. I'm pulling my hair out, any help is greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 12 replies
-
It is possible, but not straightforward. I'm not even sure I got it right! The problems come mostly from the fact that the build is done by Vite, which uses the getPlatformProxy function to interact the with Cloudflare locally... You need to run an instance of your worker separately so Vite can talk to it. Do you use Cloudflare Pages or the new Workers Assets? |
Beta Was this translation helpful? Give feedback.
-
I am very interested in this too, I wonder if there is a sample project out there we can follow This is a possible solution, tried integrating it but i was not really able to make it work, most likely the error is on my part: |
Beta Was this translation helpful? Give feedback.
-
Spotted this recently: Can't vouch for it yet – docs are a bit too lightweight – but it's trying to tackle this. |
Beta Was this translation helpful? Give feedback.
-
This is now solved by Cloudflare's native vite plugin: https://blog.cloudflare.com/introducing-the-cloudflare-vite-plugin/ |
Beta Was this translation helpful? Give feedback.
-
My understanding is that you cannot run your rr7 app and Durable Objects
from the same worker.
Instead, you have to create a new worker with the DOs and add it as a
service binding to your rr7 worker.
Can anyone confirm or deny this?
I made my app work with this method.
…On Fri, 18 Apr 2025, 01:07 Alan Lindsay, ***@***.***> wrote:
This is now solved by Cloudflare's native vite plugin:
https://blog.cloudflare.com/introducing-the-cloudflare-vite-plugin/
—
Reply to this email directly, view it on GitHub
<#12565 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALNV4BO7CHRWI2JGIWKUT22A64TAVCNFSM6AAAAABTXWVD6WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEOBXGI3DOOI>
.
You are receiving this because you are subscribed to this thread.Message
ID: <remix-run/react-router/repo-discussions/12565/comments/12872679@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
This has all been really useful so far. Thank you all. I've just got a small piece missing from my mental model – maybe others do too? ✅ I've got a fresh RR setup from cloudflare CLI. ✅ I've defined my DO. It's a clone of the websocket + hibernate example. ✅ Added DO Bindings ✅ Imported the DO from worker entrypoint -- All good so far –– Missing piece: how do I hit the DO's websocket endpoint? How do I call the fetch method that upgrades the http connection? ❌ Tried a loader like this: export async function loader({ context, request }: Route.LoaderArgs) {
const id = context.cloudflare.env.LIKE_SERVER.idFromName("my-like-server");
const stub = context.cloudflare.env.LIKE_SERVER.get(id);
return stub.fetch(request);
} …But react-router really doesn't want to return that handshake. |
Beta Was this translation helpful? Give feedback.
This is now solved by Cloudflare's native vite plugin: https://blog.cloudflare.com/introducing-the-cloudflare-vite-plugin/