wrangler Workflow steps support dynamic retry delays in local dev
Introduced 2026-07-09 · score 0.92
HOW TO USE IT
When a Workflow step needs a retry delay that varies by failed attempt, set `retries.delay` to a function that receives `{ ctx, error }` and returns milliseconds or a duration string.
await step.do("call flaky API", { retries: { limit: 5, backoff: "constant", delay: ({ ctx }) => ctx.attempt * 1000 } }, async () => { /* ... */ });WHY THIS HELPS
Set per-attempt retry delays for a Workflow step when running it in local development.
BEFORE THIS CHANGE
Step retries used fixed delay durations with a backoff strategy.
REQUIREMENTS AND LIMITATIONS
- Version: 4.110.0
- Availability: In local dev.
- retries.limit (required): Maximum number of retries for the step.
- retries.delay (required): Fixed duration or function returning the next delay in milliseconds or as a duration string.
- retries.backoff: Retry backoff strategy: `constant`, `linear`, or `exponential`.
- ctx (required): Current Workflow step context; `ctx.attempt` is the 1-indexed attempt number.
- error (required): Error that caused the retry.
- Prerequisite: Cloudflare Workflows is available on Free and Paid plans.
- The function is invoked once per failed attempt with a 5 second timeout.
- If the function throws, times out, or returns an invalid value, the step fails without further retries.
- Docs conflict: The current retry documentation was updated after Wrangler 4.110.0 and also documents Promise-returning delay functions; that support is not stated in the release note.
FIRST-PARTY EVIDENCE
- https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.110.0
- https://developers.cloudflare.com/workflows/build/sleeping-and-retrying/
- https://developers.cloudflare.com/workflows/build/step-context/
- https://developers.cloudflare.com/workflows/
- https://developers.cloudflare.com/changelog/post/2026-07-09-dynamic-retry-delays/
Check the installed version and the source before using it. Entry JSON