Vite with WorkerEntrypoint (RPC)
I'm trying to run Hono app on Vite as Cloudflare Worker. I'm using
@cloudflare/vite-plugin
and I'm getting following error when vite serve
: Worker "core:user:minerva-gateway"'s binding "AUTH_SERVICE" refers to a service "core:user:minerva-auth", but no such service is defined.
The problem might be because I use WorkerEntrypoint (to enable RPC), does Vite support it? If so, where should I define the service?6 Replies
Hi! Do you have something I could repro to see the error myself? I'm going to assume you're using standing up an auth service on one Worker, and trying to communicate to that Worker from another service using a service binding (via WorkerEntrypoint). Is that accurate? If so, here's an example of how to have multiple workers with the Vite plugin: https://github.com/cloudflare/workers-sdk/tree/main/packages/vite-plugin-cloudflare/playground/multi-worker
Let me know if you're attempting something else, and would love to help!
GitHub
workers-sdk/packages/vite-plugin-cloudflare/playground/multi-worker...
⛅️ Home to Wrangler, the CLI for Cloudflare Workers® - cloudflare/workers-sdk
Thanks! That'll do.
@korinne I was trying to figure it out and I'm stuck at the problem that the worker cannot access the database. I have found out (https://github.com/cloudflare/workers-sdk/issues/8980) that it has to be specified in
vite.config.ts
but I couldn't find anything named persist
in the plugin options. Would you be so kind to clarify? 🙏GitHub
Local D1 Access Fails When Invoked via Service Binding · Issue #89...
Which Cloudflare product(s) does this pertain to? D1 What versions & operating system are you using? @cloudflare/vite-plugin v1.0.2+, Wrangler v4.11.1+ on macOs Describe the Bug I am seeing a s...
Hi @w7a9q ! I believe it's the
persistState
config option you're looking for: https://developers.cloudflare.com/workers/vite-plugin/reference/api/
Hope that helps!@korinne Ah, yes. Thank you! One question though, what if the "main" worker uses more than one auxiliary worker with D1 binding? Is that yet to be supported?
persistState
doesn't accept an array.Hmm good question -- meeting with the team tomorrow morning and will ask, and follow up!