Service Binding: local dev method
# workers-help
m
Hi, I'm developing 2 workers for the same project/account, in a Service Binding fashion. When deployed, the workers A is successfully able to call B. But locally, the Service Binding is actually undefined. Anyone can help? I have no idea why it can't see each other when running locally. This is my env during dev, for Workers A (caller):
Copy code
[env.dev]
vars = { ENVIRONMENT = "dev", ENV = "dev" }
services = [
  { binding = "SERVICES", service = "workers-services", environment = "dev" }
]
And this is for Workers B (being called):
Copy code
[env.dev]
name = "workers-services"
vars = { ENVIRONMENT = "dev", ENV = "dev" }
When I run with --remote (using Wrangler v3.0.0), I get this error: *text: 'workers.api.error.service_binding_env_error: could not resolve binding "SERVICES": environment "dev" not found for service "workers-services" [code: 10144]'* These are however separate project, one is Bundled (A) and one is Unbound (B). One is nodejs compat (B), one is not (A). So, to summarize: - when running with
--remote
, it spits out the error message just a short time after starting - when running locally (which is the default since wrangler v3.0.0 I assume), the
env.SERVICE
is
undefined
- running live (after deploy), no problem.
Can you help with this problem @Helpflare ?