I am unable to bind a worker to another worker in local development. env.BINDING is always undefined
I am following these instructions but it is not working: https://developers.cloudflare.com/workers/platform/bindings/about-service-bindings/#wranglers
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
Are you trying to call the service binding, or are you just
console.log
ing your Environment?@HardAtWork I am console.logging the environment both
console.log(env)
and console.log(env.BINDING)
IIRC, most bindings aren't loggable. It should be present and callable, you just won't it in the logs.
I'll get it a shot, brb
Nope, not working:
Just to make sure, can I see your
wrangler.toml
?sure
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
?
Well, switching to --local
does not solve the issue either, same errorUm, I just realized something. Let me ask...
Do you have an instance of running for the
tenant-manager
worker?i just noticed this in the docs:
For each Worker^ Nope That must be it
It occurred to me that
wrangler
wouldn't have any way of knowing what code to run for the Service Binding...
🤦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!
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.