Service Binding for DO does not show up in env

I have a worker (WorkerA) that implements a Durable Object (DOA). This is working fine. I can access env.DOA and call functions on the Durable Object just fine. I have a second worker (WorkerB) that declares DOA as a service binding to WorkerA. When I call env.DOA in this second worker, I get an object with type Fetcher rather than DurableObjectNamespace. Is this expected? Has anyone else run into this? Am I holding this wrong?
5 Replies
_keehun
_keehunOP3mo ago
In WorkerA's wrangler.toml, I have:
[[durable_objects.bindings]]
name = "DOA"
class_name = "MyDoClass"

[[migrations]]
tag = "v1"
new_sqlite_classes = ["MyDoClass"]
[[durable_objects.bindings]]
name = "DOA"
class_name = "MyDoClass"

[[migrations]]
tag = "v1"
new_sqlite_classes = ["MyDoClass"]
in WorkerB's wrangler.toml, I have:
services = [{ binding = "DOA", service = "WorkerA" }]
services = [{ binding = "DOA", service = "WorkerA" }]
This seems like it's only for HTTP binding? Do I need to do something else to have an RPC binding?
_keehun
_keehunOP3mo ago
Oh, maybe this is not yet supported? https://github.com/cloudflare/workers-sdk/issues/5918
GitHub
🚀 Feature Request:RPC Support for Durable Objects in wrangler dev...
Describe the solution When binding a durable object using RPC that was defined in a different worker, it fails with: Cannot access MyDurableObject#myMethod as Durable Object RPC is not yet suppor...
_keehun
_keehunOP3mo ago
I wanted to be able to keep WorkerA behind ZT but allow WorkerB outside of it I'm trying to bind to its DO. Let me give that a try.
_keehun
_keehunOP3mo ago
Ah, now I get the "true" error:
No description
_keehun
_keehunOP3mo ago
Ahh, yes. I just checked with a deploy, and it worked. Thanks!
Want results from more Discord servers?
Add your server