Getting service bindings to work
Hi there, I'm trying to get one worker to call another worker. Both workers are on the same account.
Say that I have worker Apple and worker Banana. I want a method within Apple to call Banana.
In the Apple wrangler.toml, I have the service binding:
I deployed both workers, Apple and Banana.
Within my entrypoint
In my interface declaration for my
Within a method in my Apple worker, I am trying to call Banana with the following code:
After deploying both and setting
Your help is much appreciated!!
Say that I have worker Apple and worker Banana. I want a method within Apple to call Banana.
In the Apple wrangler.toml, I have the service binding:
I deployed both workers, Apple and Banana.
Within my entrypoint
worker.ts file for the Apple worker, I assign the env variables to an exported variable that other code files can access within the Apple directory. Such as:In my interface declaration for my
sharedEnv variable that is of type Env, I make sure to put Banana as a type Fetcher:Within a method in my Apple worker, I am trying to call Banana with the following code:
After deploying both and setting
wrangler tail to tail the logs of both workers, I see that something errors out in my fetch call to Banana from the Apple worker. But, when I peek into the logs for Banana, there are no logs written. Am I missing something that is causing Apple to not successfully reach Banana?Your help is much appreciated!!