Thanks @FlikTeoh, totally agree the docs
Thanks @FlikTeoh, totally agree the docs are impressive, I have read the RPC documentation and implemented it across other workers, this scenario is slightly different from documented. Or at least I couldn't work out from the docs how to implement my scenario...
I have a worker with the following simplified code:
In order to do a service to service binding I have the RPC or fetch option. With the RPC approach I have to export a class that extends
WorkerEntrypoint
, in which case how do I also export the endpoints?
If I want to use the HTTP fetch interface how would I export a fetch handler and also the other endpoints via Hono?
I'm starting to wonder if there is a problem with my solution design, might rethink it, in the meantime any examples or pointers appreciated.7 Replies
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Thanks for the response @FlikTeoh, here's what I tried...
here's the code I'm using to invoke the worker via RPC:
The service binding definition:
but I get this error:
TypeError: env.jobsAiGateway.getTargetRoleAnalyser is not a function
And the code in the jobsAiGateway worker is:
Not sure what I'm doing wrong, any pointers would be greatly appreciated.Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
The
env
is being accessed in a CF worker that is a queue consumer, here's the code:
As you can see the worker has a fetch handler and a Queue consumer handler, which is passed env
from the Queue.
The output of the console.log
line for env
is:
Thanks for your help so far, it's much appreciated.Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Compatibility date change worked, now getting the object back from the RPC call. Thanks for your help, it's much appreciated.
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View