Worker Previews
Worker Previews is Cloudflare's approach to testing a Worker on each development branch before its code reaches production. This guide is for developers building Workers, including teams whose coding agents make changes that need runtime review. The announcement explains why a shared staging site is a poor fit for parallel changes: each branch can instead have a stable URL, its own configuration, and observability scoped to that preview. The URL can be opened by a person, test runner, or browser agent to check actual responses and user flows.
Start with Cloudflare's Preview setup documentation. Define a previews block in the Wrangler configuration, choose test bindings and variables, and add preview secrets through the documented commands. Then run npx wrangler preview on a feature branch. Repeating the command updates that branch's preview URL; a deployment URL remains pinned to one particular deployment. A Git-connected Worker can also create previews on push. Send test requests to the preview, then inspect its logs, errors, and traces before reviewing or merging the change.
The isolation boundary matters. Cloudflare provisions separate Durable Object namespaces and Container instances for previews. KV, D1, and R2 need bindings to separate resources if you want their data isolated; previews do not inherit production settings. The resource isolation guide is the checklist to use before letting an agent exercise write paths. Preview URLs are public by default, so use Cloudflare Access when a test environment contains private workflows. Current limitations include service bindings that reach the bound Worker's production deployment and Queue consumers that cannot run in a preview. These gaps mean a preview of a multi-Worker or asynchronous system may cover only part of its behavior.
Example use cases
- Suggested application — agent code review: Have a coding agent deploy its branch, probe changed API routes, inspect preview traces, and attach the URL and findings to its review.
- Suggested application — state migration rehearsal: Bind a branch preview to test storage and check Durable Object schema changes with disposable records before merging.
- Suggested application — sign-in flow check: Give a preview a custom domain, protect it with Access, and exercise OAuth redirects in a browser before release.
Sources
- Cloudflare: Introducing Worker Previews
- Cloudflare Workers: Previews documentation
- Cloudflare Workers: Resources and isolation
- Cloudflare Workers: Limitations
Source image: Cloudflare.
Maintained by Jetskibay. Reviewed 2026-09-29T00:00:00Z.
