Execute some code before worker starts

Hi team, I would like to know if it is possible to execute something in a worker just once, at the start. Example: - subscribe to webhooks to a 3rd party system. - set up a "fetch" receiver or an app using Hono.
2 Replies
kian
kian4mo ago
You can store it in the global scope and only instantiate it with a if (!var) {...} block in your handler, but that's about it.
Eusebio Trigo
Eusebio Trigo4mo ago
I ended up creating an endpoint and in that endpoint handler create the webhooks my appllication / worker needs... Or we could so something on CI / CD in the pipeline, of course, before publishing the worker...