I am unable to bind a worker to another worker in local development. env.BINDING is always undefined

About Service bindings · Cloudflare Workers docs
Service bindings are an API that facilitate Worker-to-Worker communication via explicit bindings defined in your configuration.
14 Replies
Hello, I’m Allie!
Are you trying to call the service binding, or are you just console.loging your Environment?
jasonkuhrt
jasonkuhrtOP2y ago
@HardAtWork I am console.logging the environment both console.log(env) and console.log(env.BINDING)
Hello, I’m Allie!
IIRC, most bindings aren't loggable. It should be present and callable, you just won't it in the logs.
jasonkuhrt
jasonkuhrtOP2y ago
I'll get it a shot, brb
jasonkuhrt
jasonkuhrtOP2y ago
Nope, not working:
Hello, I’m Allie!
Just to make sure, can I see your wrangler.toml?
jasonkuhrt
jasonkuhrtOP2y ago
sure
jasonkuhrt
jasonkuhrtOP2y ago
jasonkuhrt
jasonkuhrtOP2y ago
The binding works in the deployed worker, at least the deploy logs and dashboard show the binding This is how I run wrangler, is the issue I am using --experimental-local?
wrangler dev --test-scheduled --experimental-local
wrangler dev --test-scheduled --experimental-local
Well, switching to --local does not solve the issue either, same error
Hello, I’m Allie!
Um, I just realized something. Let me ask... Do you have an instance of
wrangler dev --test-scheduled --local
wrangler dev --test-scheduled --local
running for the tenant-manager worker?
jasonkuhrt
jasonkuhrtOP2y ago
i just noticed this in the docs:
For each Worker
^ Nope That must be it
Hello, I’m Allie!
It occurred to me that wrangler wouldn't have any way of knowing what code to run for the Service Binding... 🤦
jasonkuhrt
jasonkuhrtOP2y ago
That was it, thanks! I was wondering about that. Like would it mock or something. One step at a time was my thinking. Thanks for your help!
Hello, I’m Allie!
The difficulty there is where does it get it from? Should it pull from the deployed version? That code may not be optimized for local dev.
Want results from more Discord servers?
Add your server