Cloudflare Cron Triggers let you run Workers on a schedule without managing a server or cron daemon. You define cron expressions in wrangler.jsonc under triggers.crons, then implement a scheduled handler instead of (or alongside) the usual fetch handler. The handler receives env bindings, so you can query D1 databases, write to storage, or send emails. Key gotchas include: schedules run in UTC, and long-running async work should be wrapped in ctx.waitUntil. Local testing is possible by running wrangler dev and hitting a special curl endpoint to trigger the handler immediately.

3m read timeFrom flaviocopes.com
Post cover image
Table of contents
Add a scheduleHandle the scheduleA real exampleBe careful with time zonesLong jobs and waitUntilTesting it locallyWhat I use it for
200 Impressions