Skip to content

Vercel Schedules in public beta and automatic retries for Cloudflare Durable Object calls.

Published

Two dev announcements today. Vercel, the serverless platform, released Schedules, which runs tasks at set times, in public beta. Cloudflare changed its runtime so that a failed call to a Durable Object, its stateful objects, is retried automatically. One runs code on a timer and the other runs it again after a failure, so both raise the same question: can this code safely run twice?

데이터 표
Vercel SchedulesNovember 5Recurring and one-time runs in public beta on all plans
Cloudflare Durable Objects automatic retriesNovember 5Calls that fail before reaching the object are retried up to four times by default

Source: the original post for each item.

Vercel Schedules (November 5). Vercel Schedules runs a task on a recurring schedule or once at a single point in time. It is in public beta on all plans and runs in production, preview or custom environments. Any schedule can be enabled, disabled or run on demand without redeploying.

Image from the Vercel Schedules public beta post

Image: Vercel Changelog

There are two ways to create a schedule. A static schedule in vercel.json can target a private Vercel Function, an HTTP path or a Vercel Queue topic. The example calls api/cleanup.ts with the cron expression 0 * * * * in the America/New_York time zone. Giving the function an experimentalTriggers entry of type schedule/v1beta makes it private, with no public URL, so only Vercel's schedule infrastructure can invoke it. The handler is wrapped with handleSchedule from @vercel/schedules.

A schedule created at runtime uses Schedules.create and targets a Queue topic. The example sends the payload { reportType: 'summary' } to the digests topic every day at 9 a.m.

Vercel SchedulesRecurring or one-time runs
Static scheduleWritten in vercel.json
Created at runtimeMade with Schedules.create
TargetsPrivate function, HTTP path or Queue topic
TargetQueue topic only
  • Vercel Schedules → Static schedule
  • Vercel Schedules → Created at runtime
  • Static schedule → Targets
  • Created at runtime → Target
Source: Vercel Changelog.

Existing Cron Jobs keep working, and Schedules is presented as their successor. A migration guide covers moving over. Pricing on Pro and Enterprise is $5 per 1M runs and $10 per 1M creations. Hobby includes 500 schedule creations and 5,000 runs per month.

Cloudflare Durable Objects automatic retries (November 5). Durable Objects are the Cloudflare Workers feature for objects that keep state. The runtime now retries fetch() and RPC calls that fail with a retryable error before reaching the object. It applies whether the caller is a Worker or another Durable Object.

Image from the Cloudflare post on Durable Object automatic retries

Image: Cloudflare Changelog

The default is up to four retries per call, and no retry starts more than 10 seconds after the initial call starts. Errors thrown by the Durable Object's own code and errors with .overloaded set to true are not retried. If the connection drops and the runtime cannot tell whether the object received the call, it still retries, and the Durable Object rejects the retry if the first attempt arrived.

Whether a method may run twice is up to you. Only methods marked with retryable() from cloudflare:durable-objects can run twice because of a retry. The example marks setQuantity, which does an idempotent storage.put, and leaves addOne, which increments a count, unmarked. You can also pass a retry option to get() or getByName() per stub, with maxRetries from 0 to 10 and timeoutMs from 500 to 60,000 milliseconds. retryable() and the retry option need Wrangler 4.158.0 or later.

CallFrom a Worker or another Durable Object
Retryable errorFails before reaching the object
Not retriedErrors thrown by object code, overloaded
RuntimeUp to four retries by default
  • Call → Retryable error
  • Retryable error → Runtime
  • Call → Not retried
Source: Cloudflare Changelog.

If you already have your own retry code, the post advises lowering your attempt count, or setting maxRetries: 0 on the stubs where your code handles retries.

Both announcements move behavior you used to write yourself into the platform, so the places to check overlap. When moving from Cron Jobs to Schedules, compare the target, the environment, how the schedule is created and the pricing together. For code that calls Durable Objects, first look for existing retries, and if there are any, adjust the counts so the two layers do not multiply. For a new project Schedules is worth trying, but it is a beta, and the post gives no reason to rush a production cron job over.