I’m in need of some help with setting up service bindings.
I have successfully bound a service worker to another worker (confirmed in wrangler response and the worker settings in the dashboard), but the binding is not defined on the environment of the gateway worker. If I log the keys of the environment, I get all I expect there - environment variables and kv binding names, but the service binding is missing. It is defined in wrangler.toml as:
services = [
{ binding = "generate_invoice", service = "cfworker-transact-generate-invoice", environment = "production" }
]
I’ve tried the alternate syntax but that failed to even create the binding in wrangler.
The usage is basic right now for testing:
export default {
async fetch(request, env, context) {
env.generate_invoice.fetch(new Request())
return new Response('called')
}
}
I get the response Cannot read properties of undefined (reading 'fetch')
every time.
Using wrangler 2.0.16
Is there something additional I’m missing to enable these bindings?