So today I wanted to send an API post call to another worker from worker, and i had weird error that “an error happened bla bla”. We are not allowed to call for worker from worker?
If you can, use Service Bindings (About Service bindings · Cloudflare Workers docs), Service Bindings let you invoke another worker from your worker, but without any network latency, they run in the same V8 isolate/thread. Same request/fetch interface, just faster and without restrictions.
When calling a worker from another worker, they cannot be the same “zone” (zones being essentially domains, everything listed under Websites in your CF Dash is a zone), as in, if your worker runs on a custom domain or route (worker1.example.com), it cannot fetch worker2.example.com. Same for the default workers.dev domain, worker1.yourworkersdev.workers.dev can’t fetch worker2.yourworkersdev.workers.dev but you can call a worker from a worker on a different zone (worker.dev → custom, etc).
Ok, thanks…
What about Queues? Can I send queue message from worker to worker in same zone?
You mean send a message to a queue, when the queue handler worker happens to have a route/custom domain on that same zone? Yea, the restriction is just on fetch.