Cron Triggers scheduled handler implementation
To respond to a Cron Trigger, add a 'scheduled' handler to your Worker. In JavaScript: export default { async scheduled(controller, env, ctx) { ... } }. In TypeScript: async scheduled(controller: ScheduledController, env: Env, ctx: ExecutionContext) { ... }. In Python: async def scheduled(self, controller, env, ctx) with all four parameters including self required.
Cron expression field specifications
Cron expressions support five fields with the following specifications: Minute (0-59, characters: * , - /), Hours (0-23, characters: * , - /), Days of Month (1-31, characters: * , - / L W), Months (1-12 or case-insensitive 3-letter abbreviations like JAN/aug, characters: * , - /), Weekdays (1-7 where 1=Sunday to 7=Saturday, or case-insensitive 3-letter abbreviations like MON/fri, characters: * , - / L #). Weekday numbering differs from some other cron systems where 0=Sunday and 6=Saturday.
Common cron expression examples
Common cron patterns: '* * * * *' (every minute), '*/30 * * * *' (every 30th minute), '45 * * * *' (45th minute of every hour), '0 17 * * sun' or '0 17 * * 1' (17:00 UTC on Sunday), '10 7 * * mon-fri' or '10 7 * * 2-6' (07:10 UTC on weekdays), '0 15 1 * *' (15:00 UTC on first day of month), '0 18 * * 6L' or '0 18 * * friL' (18:00 UTC on last Friday of month), '59 23 LW * *' (23:59 UTC on last weekday of month).
Test Cron Triggers locally with wrangler dev
Test Cron Triggers using 'wrangler dev' or the Cloudflare Vite plugin, which expose a '/cdn-cgi/handler/scheduled' route. Use curl to test: 'curl http://localhost:8787/cdn-cgi/handler/scheduled'. Add '?format=json' to return structured JSON results. Use the 'cron' query parameter to simulate different cron patterns: 'curl http://localhost:8787/cdn-cgi/handler/scheduled?cron=*+*+*+*+*'. Use the 'time' query parameter to override controller.scheduledTime: 'curl http://localhost:8787/cdn-cgi/handler/scheduled?cron=*+*+*+*+*&time=1745856238000'. The endpoint returns 'noRetry: true' when controller.noRetry() is called.
Cron Trigger configuration propagation time
Changes to Cron Triggers such as adding, updating, or deleting a Cron Trigger may take several minutes (up to 15 minutes) to propagate to the Cloudflare global network.
Cron Triggers execute on UTC time
All Cron Triggers execute on UTC time.
Managing Cron Triggers with Wrangler
If a Worker is managed with Wrangler, Cron Triggers should be exclusively managed through the Wrangler configuration file, not the dashboard. When deploying a Worker with Wrangler, any previous Cron Triggers are replaced with those specified in the 'triggers.crons' array. If 'crons' is an empty array, all Cron Triggers are removed. If 'triggers' or 'crons' are undefined, the currently deployed Cron Triggers are left in-place.
View Cron Trigger execution history
Cron Events stores the 100 most recent invocations of the Cron scheduled event in the Cloudflare dashboard under Workers & Pages > Worker > Settings > Trigger Events > View events. Workers Logs also records invocation logs for Cron Triggers with a longer retention period and filter/query interface. It can take up to 30 minutes before events are displayed in Past Cron Events when creating a new Worker or changing a Worker's name.
Green Compute for Cron Triggers
With Green Compute enabled, Cron Triggers run only on Cloudflare points of presence in data centers powered purely by renewable energy. Green Compute can be configured at the account level in the Cloudflare dashboard under Workers & Pages > Account details > Compute Setting > Change > Green Compute.
triggers configuration field for cron
The triggers field is an optional object used to define cron expressions that trigger a Worker's scheduled function. It contains a crons field which is a required array of cron expression strings. To disable a Cron Trigger, set crons = []. Commenting out the crons key will not disable a Cron Trigger.
triggers field in Wrangler v1 configuration
The triggers field is inherited and optional. It configures cron triggers for running a Worker on a schedule. It contains a crons field (optional) that is a set of cron expressions, where each expression is a separate schedule to run the Worker on.