# Cloudflare Workers Cron Triggers: UTC Syntax, L/W/# Modifiers, and Multi-Cron Routing

> Configure wrangler.jsonc triggers.crons in UTC, dispatch multiple schedules cleanly via controller.cron in scheduled(), and protect async tasks with ctx.waitUntil.

- **Canonical URL**: https://opslint.dev/cron/cloudflare-workers-cron-triggers-utc-expressions/
- **Category**: `CRON`
- **Interactive Workbench**: [Open in Live Workbench](https://opslint.dev/cron/#expr=*/15%20*%20*%20*%20*&tz=UTC)
- **Normative Specifications**: `Cloudflare Workers Docs: Cron Triggers & ScheduledController API`, `wrangler.jsonc Configuration: triggers.crons`

## Incident Symptom & Root Cause

**Production Symptom**: A Cloudflare Worker scheduled() handler terminates mid-flight before finishing database/API writes, all configured cron expressions execute the exact same code path because event.cron isn't switched, or deploying a cron with a timezone prefix fails Wrangler validation.

**Protocol / Engine Root Cause**: Cloudflare Workers evaluates all Cron Triggers strictly in UTC (supporting 5 fields plus Quartz-like L, W, and # day modifiers), invokes a single exported async scheduled(controller, env, ctx) entrypoint for every trigger on the Worker, and may cancel unawaited promises unless passed to ctx.waitUntil(...) or awaited directly.

## Remediation Diff (Broken vs Verified Fix)

### Unrouted Multi-Cron Handler & Unawaited Promise Drop

```text
// wrangler.jsonc:
// { "triggers": { "crons": ["*/5 * * * *", "0 2 * * *"] } }

export default {
  // BUG 1: Both */5 and 0 2 run heavyNightlyCleanup() every 5 minutes!
  // BUG 2: Floating unawaited promise gets killed as soon as scheduled() returns!
  scheduled(controller: ScheduledController, env: Env, ctx: ExecutionContext) {
    syncFastMetrics(env);
    heavyNightlyCleanup(env);
  },
};
```

### wrangler.jsonc + Exact controller.cron Switch & ctx.waitUntil

```text
// wrangler.jsonc
// {
//   "triggers": {
//     "crons": ["*/5 * * * *", "0 2 * * *", "55 23 L * *"]
//   }
// }

export default {
  async scheduled(
    controller: ScheduledController,
    env: Env,
    ctx: ExecutionContext
  ): Promise<void> {
    switch (controller.cron) {
      case "*/5 * * * *":
        ctx.waitUntil(syncFastMetrics(env, controller.scheduledTime));
        break;
      case "0 2 * * *":
        ctx.waitUntil(heavyNightlyCleanup(env));
        break;
      case "55 23 L * *":
        ctx.waitUntil(closeMonthlyUsage(env));
        break;
      default:
        throw new Error(`Unhandled cron expression: ${controller.cron}`);
    }
  },
};
```

## Engineering Deep Dive

Cloudflare Workers Cron Triggers execute on Cloudflare's edge control plane at zero idle cost, invoking your Worker's scheduled(controller, env, ctx) handler with controller.cron (the exact string from wrangler.jsonc) and controller.scheduledTime (the nominal Unix epoch millisecond timestamp of the tick). Switching on controller.cron lets one Worker host multiple distinct schedules—such as a 5-minute health check, a nightly purge, and a month-end billing rollup—without deploying separate Worker services.

Note two syntax differences between Cloudflare Workers Cron Triggers and AWS EventBridge: Workers typically use 5 fields (minute, hour, day-of-month, month, day-of-week) ALWAYS evaluated in UTC, yet unlike strict POSIX cron, Cloudflare's parser DOES support L (last day of month or week, such as 55 23 L * *), W (nearest weekday, such as 0 9 15W * *), and # (Nth weekday of month, such as 0 9 * * 2#1 or MON#1) without requiring a 6th Year field!

When testing locally with npx wrangler dev --test-scheduled, Wrangler exposes a local HTTP endpoint: run curl 'http://127.0.0.1:8787/__scheduled?cron=*+*+*+*+*' to trigger specific controller.cron branches deterministically on localhost before deploying. Keep in mind that Cron Trigger propagation across Cloudflare's global network can take up to 15 minutes after wrangler deploy.

## Cloudflare Workers Cron Triggers Operational Reference

| Case / Engine | Protocol Behavior | Production Remediation |
| :--- | :--- | :--- |
| **Timezone evaluation** (`#cf-workers-utc-only`) | 100% UTC only; no timezone property exists in wrangler.jsonc triggers.crons. | Keep schedules in UTC, or run hourly (0 * * * *) and check Intl.DateTimeFormat local hour inside JS for DST-sensitive tasks. |
| **Multiple crons in triggers.crons** (`#cf-workers-multi-route`) | Every cron invokes the same scheduled(controller, env, ctx) export. | Switch strictly on controller.cron (must match wrangler.jsonc string character-for-character). |
| **Local testing in wrangler dev** (`#cf-workers-local-test`) | Crons do not fire automatically unless triggered or --test-scheduled is enabled. | Run wrangler dev --test-scheduled and curl 'http://127.0.0.1:8787/__scheduled?cron=0+2+*+*+*'. |
| **Execution & wall-clock limits** (`#cf-workers-cpu-limits`) | Unawaited async I/O terminates when scheduled() returns unless registered with ctx.waitUntil(). | Always await tasks or wrap in ctx.waitUntil(promise); offload multi-step durable jobs to Workflows/Queues. |

## Frequently Asked Engineering Questions

### How do I run a Cloudflare Worker at 09:00 America/New_York year-round across DST if Workers Cron is UTC-only?

Configure triggers.crons to fire at BOTH candidate UTC hours ("0 13,14 * * 1-5" — 13:00 UTC is 09:00 EDT; 14:00 UTC is 09:00 EST) and at the first line of scheduled() verify the current local hour via new Intl.DateTimeFormat('en-US', { timeZone: 'America/New_York', hour: 'numeric', hour12: false }).format(new Date(controller.scheduledTime)) === '09'!

### How many Cron Triggers can a single Cloudflare Worker have?

Check account plan quotas: Free plans allow up to 5 Cron Triggers across the account (3 per Worker historically, check current Workers limits), while Workers Paid plans dramatically raise trigger and CPU ceilings (up to 15 minutes CPU time for Cron Triggers >=15m apart).

### Why did renaming '0/15 * * * *' in wrangler.jsonc break my switch(controller.cron) statement?

controller.cron passes the literal expression string configured in triggers.crons. Define shared constant strings or normalize whitespace so wrangler.jsonc and TypeScript switch cases never drift.

## Related Problem-Cluster Guides

- [AWS EventBridge Rules (UTC Only) vs EventBridge Scheduler (IANA Timezones)](https://opslint.dev/cron/aws-eventbridge-rules-utc-vs-scheduler-timezone/) — Why legacy CloudWatch / EventBridge Rules ignore local timezones and DST, and how to migrate to AWS EventBridge Scheduler with ScheduleExpressionTimezone.
- [GitHub Actions Schedule Timezone Syntax, 5-Minute Floor, and Queue Delay Fixes](https://opslint.dev/cron/github-actions-schedule-timezone-and-queue-delay/) — Configure native IANA timezones on GitHub Actions on.schedule triggers, avoid silent 5-minute interval clamping, and eliminate top-of-hour queue delays.
- [Run a Cron Job on the Last Day of Every Month (28, 29, 30, and 31 Leap-Year Safe)](https://opslint.dev/cron/last-day-of-month-leap-year-cron-patterns/) — Portable month-end cron patterns across POSIX Linux/BSD, Kubernetes CronJob, GitHub Actions, AWS EventBridge (L), and systemd (~01) including February 29.
- [Cron Jobs Skipped During Daylight Saving Time Spring Forward (02:00–02:59 Gap)](https://opslint.dev/cron/dst-spring-forward-skipped-jobs/) — Why 02:30 local cron schedules vanish on Kubernetes CronJob and AWS EventBridge while Vixie Cron runs catch-up at 03:00, and how to prevent missed runs.
