# Background jobs and cron: Cloudflare vs Trigger.dev

> Your AI-built app needs scheduled syncs, emails and AI tasks that outlive a request. When Cloudflare Cron Triggers is enough and when to use Trigger.dev.

By Tommy Pham · 2026-11-14 · https://tommydev.web.app/blog/background-jobs-cron-trigger-dev-vs-cloudflare

**Short answer:** use **Cloudflare Cron Triggers** for short, scheduled work: sync a feed every 15 minutes, send reminders, clean up old rows. Use **Trigger.dev** (or a similar job platform) for long or multi-step work: AI pipelines, scraping, anything that needs retries, waits or visibility into each run. Don't do either inside a normal API request on serverless hosting, where it will time out.

I've used both in production: a Cloudflare cron syncs Airbnb calendars in [StayFlow](/work/stayflow-pms), and Trigger.dev runs AI research reports and data syncs in [PainBase](/work/painbase).

## Why do AI-built apps need background jobs?

AI builders write everything as request-response: the user clicks, the server does the work, the page updates. That breaks when the work:

- takes longer than your host's request timeout (an AI report, a big import),
- has to run on a schedule with nobody clicking (daily digests, syncs),
- must survive failure and retry (calling flaky third-party APIs),
- or fans out into many steps (scrape 500 pages, then summarise them).

## How do the two compare?

| | Cloudflare Cron Triggers | Trigger.dev |
|---|---|---|
| What it is | A schedule that invokes your Worker | A platform for durable background tasks |
| Best for | Short scheduled jobs | Long, multi-step, retryable jobs |
| Schedule precision | Every minute at most, UTC | Cron schedules plus on-demand triggers |
| Long-running work | Bound by Workers CPU and duration limits | Built for long tasks; waits can be checkpointed |
| Retries | You write them | Built in, configurable per task |
| Run history and logs | Basic | A dashboard per run, with logs and replays |
| Free plan cron limit (Nov 2026) | 5 per account (250 on paid) | Depends on plan |
| Where code runs | Your Worker | Trigger.dev's cloud (or self-hosted) |

## When is a Cloudflare cron enough?

When the job is short and you're already on Workers. In StayFlow, a cron fires every 15 minutes, fetches each property's Airbnb iCal feed, and upserts bookings into D1. There's also a manual "reload" button that calls the same function. Short work, one schedule, no extra service to pay for. I wrote up that whole setup in [building an internal tool on Workers and D1](/blog/cloudflare-workers-d1-internal-tool).

Things to know:

- Crons run in **UTC**. "Every day at 8am" in Vietnam is `0 1 * * *`.
- A cron invocation has the same limits as any Worker, so split big jobs into batches (or hand them to Queues or Workflows).
- If it fails silently, you won't know. Log failures somewhere you'll see them.

## When should you use Trigger.dev?

When the job is long, has steps, or failure matters. In PainBase, Trigger.dev runs the AI research reports and the revenue-data syncs. That work is slow, depends on external APIs, and needs retries. Trigger.dev gives each run its own log and status, so a failed step is visible and can be retried.

Its main advantages for AI-heavy apps:

- **No request timeout.** Tasks can run for minutes or longer.
- **Retries with backoff** per task.
- **Waits** ("wait 1 hour, then send the follow-up") without paying for idle compute.
- **Visibility.** Each run is inspectable.

## What about the alternatives?

- **Vercel Cron**, which calls a route on a schedule. Same idea as Cloudflare's, with your function's time limits.
- **Supabase** `pg_cron` plus Edge Functions, if you live in Supabase.
- **Inngest** and **Upstash QStash**, comparable to Trigger.dev, with a different pricing and developer experience.
- **A VPS with a plain crontab**: cheap and unlimited, but you run the server ([VPS guide](/blog/hostinger-vs-contabo-vps)).

## FAQ

### Can I run a long AI task in a Next.js API route?

Only if it finishes within your host's function timeout. Long AI work should go to a background job, with the UI polling for progress or listening for a webhook.

### How do I test a cron locally?

Wrangler can trigger scheduled events locally: run `wrangler dev --test-scheduled` and call the local scheduled endpoint shown in [Cloudflare's cron docs](https://developers.cloudflare.com/workers/configuration/cron-triggers/#test-cron-triggers-locally). Trigger.dev has a local dev command that runs tasks against your machine.

### Do I need a queue?

If one event produces many jobs (one per user, one per URL), yes. Cloudflare Queues or Trigger.dev's batch triggers spread the work out and retry each item separately.

---

Need scheduled syncs or AI pipelines added to your app? I build these. See [my work](/#work) or get in touch below.

## Sources

- Cloudflare docs: [Cron Triggers](https://developers.cloudflare.com/workers/configuration/cron-triggers/) and [Workers limits](https://developers.cloudflare.com/workers/platform/limits/) (checked November 2026)
- [Trigger.dev product overview](https://trigger.dev/product)
- Upstash: [Serverless background jobs and message queues in 2026](https://upstash.com/blog/serverless-background-jobs-and-message-queues-every-major-option-in-2026)