Is it possible to setup two workers that bind to each other?

Hi, I'm trying to setup a system with two separate workers: first one terminates a client WebSocket connection using a durable object and routes the WebSocket messages to another worker that provides data sync functionality for clients. The data-sync worker might also need to send replies periodically to clients connected via WebSocket to the first worker. I'm setting up service bindings based on this docs page: https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#configuration Both workers expose an entrypoint class and accepts RPCs and routes them to DurableObjects. I'm testing this with a unstable_dev test like described here: https://developers.cloudflare.com/workers/wrangler/api/#multi-worker-example Unfortunatelly the test fails with:
[ERROR] Cannot access `sendMessage` as we couldn't find a `wrangler dev` session for service "router" to proxy to.
[ERROR] Cannot access `sendMessage` as we couldn't find a `wrangler dev` session for service "router" to proxy to.
It seems like there's no way to create a pair of circular bindings between two workers? Are there any alternatives that would keep the system topology mostly intact: i.e. two workers with durable objects that are able to send messages to each other?
No description
1 Reply
dmaretskyi
dmaretskyi3mo ago
It seems like exactly the same setup works if both workers are started using wrangler dev command. So this might be a bug with unstable_dev Does anyone know if the file-based registry option will help here?
Want results from more Discord servers?
Add your server