scheduled workers

Just curious how you all go about testing your scheduled workers after deployment. I've tested locally but wanted to do one run to make sure the database binding is in place properly. I could fiddle with the schedule but wondered if there was an unpublished way to kick it off in the dashboard UI or via some hidden endpoint. Thank you.
1 Reply
Chaika
Chaika9mo ago
I just make a super secret path and/or check for an auth header which can call this.scheduled() and pass env/etc as needed, then you can call your cron whenever you want ex:
if (newurl.pathname == "/yoursecretpathforcron" && request.headers... or some other auth check) {
await this.scheduled(null, env, ctx);
return new Response("ok - triggered");
}
if (newurl.pathname == "/yoursecretpathforcron" && request.headers... or some other auth check) {
await this.scheduled(null, env, ctx);
return new Response("ok - triggered");
}
Want results from more Discord servers?
Add your server