Worker Service Binding not working

Hello, we are trying to call a function of workerB like in the service binding demo article but get an error on Worker A:
ERROR: env.WORKER_B.myFunction is not a function.
ERROR: env.WORKER_B.myFunction is not a function.
The service binding is
{binding="WORKER_B", service = "worker-b-stage"}
{binding="WORKER_B", service = "worker-b-stage"}
and the worker b has:
export default class extends WorkerEntry point {
async fetch(..){..}
async myFunction(headers) {
return anotherFunction(headers)
}
...
}
export default class extends WorkerEntry point {
async fetch(..){..}
async myFunction(headers) {
return anotherFunction(headers)
}
...
}
On the worker deployment page the service binding is also showing the target worker correctly. Everything seems like the demo example but we are not able to call the function. What are we missing?
1 Reply
bene2591
bene2591OP4w ago
It appears that the compatibility_date had something to do with it! Changing it to a newer date fixed this problem...

Did you find this page helpful?