Problem connecting to actor from front end using cloudflare worker with hono
I'm not sure if how I'm setting it up wrong, but the code for cloudflare driver seems to skip setting the registry route if you pass a hono instance as an option.
https://github.com/rivet-gg/rivetkit/blob/main/packages/drivers/cloudflare-workers/src/handler.ts
I'm very confused how to add my own api routes while also having registry mounted in cloudflare worker
GitHub
rivetkit/packages/drivers/cloudflare-workers/src/handler.ts at main...
🧰 The open-source alternative to Durable Objects. Easily self-hostable and works with your infrastructure. - rivet-gg/rivetkit
7 Replies
Hey, this topic has been already covered here - https://discord.com/channels/822914074136018994/1403394492215726161/1403418432036143276
let me know if the linked example works for you!
In the meantime, I will put this as a official example!
Is it just updating the package version?
@jog1t I managed to get it working by doing this:
I'm wondering for what reason createHandler doesn't mount registry routes when passing a hono instance?
You would need to show me the code before the change, and I will tell you why! 🙂
I can show my code, but I don’t think it’s related to why the createHandler doesn’t mount the registry routes.
In the createHandler function, the if check skips mounting the registry endpoints if you pass a hono instance as an argument to createHandler
You’re right this: https://github.com/rivet-gg/rivetkit/blob/0433897ee37478366f1426061674db94a873f5e1/packages/drivers/cloudflare-workers/src/handler.ts#L78. this is not needed
Will fix this is upcoming release! Thank you so much for spotting this!
No worries! I was wondering if there was a reason the if check existed and I was doing something wrong, or if it wasn't necessary
Thanks for looking into it!
actually, you were doing it right from the beginning, this is probably some leftover!