Schedule Workflow instances directly from your Workflow binding
You can now attach cron schedules directly to Workflow bindings in wrangler.jsonc, allowing scheduled runs to automatically create new Workflow instances without needing a separate Worker with a scheduled handler. This makes building recurring jobs like database backups and report aggregation simpler.
You can now attach cron schedules directly to a Workflow binding in wrangler.jsonc. Each scheduled run creates a new Workflow instance automatically, so you do not need to define a separate Worker with a scheduled handler just to trigger your Workflow on an interval.
For example, you can configure hourly, every-15-minute, or weekday schedules on the same Workflow:
{
"workflows": [
{
"name": "my-scheduled-workflow",
"binding": "MY_WORKFLOW",
"class_name": "MyScheduledWorkflow",
"schedules": ["0 * * * *", "*/15 * * * *", "0 9 * * MON-FRI"],
},
],
}
Cron workloads get all the same benefits of Workflows with built-in retries, multi-step durable execution, and configurable timeouts of Workflows.
import {
WorkflowEntrypoint,
WorkflowEvent,
WorkflowStep,
} from "cloudflare:workers";
// Runs automatically on each cron schedule defined for the MY_WORKFLOW binding in wrangler.jsonc.
export class MyScheduledWorkflow extends WorkflowEntrypoint<Env> {
async run(event: WorkflowEvent, step: WorkflowStep) {
const data = await step.do("fetch source data", async () => {
return await fetchSourceData();
});
// If this step fails, only this step is retried with the custom logic below
await step.do(
"process and store results",
{
retries: { limit: 5, delay: "30 seconds", backoff: "exponential" },
timeout: "10 minutes",
},
async () => {
await processAndStore(data);
},
);
}
}
This makes it easier to build recurring, scheduled jobs such as database backups, invoice generation, report aggregation, and cleanup tasks without wiring up a separate Cron Trigger entrypoint.
For more information, refer to Trigger Workflows.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for Windows hotfix - trusted certificate chains
A new GA release for Windows Cloudflare One Client is available, addressing an issue with building trusted certificate chains.
Cloudflare One Client for macOS - Trusted Certificate Chain Fix
A new GA release of the macOS Cloudflare One Client is available. This hotfix addresses an issue with building trusted certificate chains.
Cloudflare One Client for Linux
A new GA release of Cloudflare One Client for Linux is now available. This hotfix addresses an issue with building trusted certificate chains.