I'm trying to get service bindings working in a dev environment, but keep just getting the following error:
Cannot read properties of undefined (reading 'fetch')
That's when I'm running wrangler dev --local in both the gateway worker and the simple fetch worker.
The code for the fetch worker is simple hello world.
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
return new Response("Hello World!");
},
};
And that worker is called counter and the service binding in the gateway is as follows:
services = [
{ binding = "counter", service = "counter", environment = "production" }
]
This originally didn't have the environment, but that didn't seem to make any difference.
When running wrangler without --local e.g. wrangler dev, it doesn't error, but the response come back empty.
Any ideas?