You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wrangler preview: require an explicit previews block only when needed (empty {} should be implied) #150
Our assets-only Worker was moved to Workers Previews. Workers Builds now runs npx wrangler preview for every non-production branch. It runs that command even when the Previews Base "Preview command" field is set to something else (wrangler versions upload --preview-alias …).
wrangler preview then fails:
✘ [ERROR] Your Wrangler configuration is missing a `previews` block to run this command.
The docs say the block "can be empty". Adding "previews": {} fixes it, but the block carries no information.
Expected
Either of these:
Treat a missing previews block as {}.
Or have Workers Builds run the configured Preview command when the Worker has no previews block.
Impact
PR preview builds failed silently for every branch until we added the empty block.
wrangler preview (wrangler 4.158.0, Workers Builds) fails with 'Your Wrangler configuration is missing a previews block' for an assets-only Worker whose config omits the block; docs say the block can be empty and adding previews:{} fixes it. Versions, steps, and expected behavior are supplied.
Reproduction reason: The report describes current wrangler preview behavior with a concrete config scenario and error; running wrangler preview with an assets-only config lacking the previews block can verify it.
Reproduction
Result: ✅ Reproduced.
Summary: Reproduced on wrangler 4.158.0: plain wrangler preview (mock Cloudflare API, dummy token) on an assets-only wrangler.json without a previews block fails with the exact reported missing-previews-block error; adding the empty "previews": {} makes the error disappear.
Evidence and attempted steps
Steps attempted:
Install the exact wrangler version reported in the issue into the minimal assets-only Worker fixture
Command: cd /workspace/reproduction-output/project && pnpm install --ignore-scripts (pins wrangler@4.158.0)
Run the plain wrangler preview command (the command Workers Builds runs) against a local mock Cloudflare API, with wrangler.json lacking a previews block
Context check that the identical error is local config validation firing before any API call
Command: wrangler preview --ignore-base-config with dummy token and account id
Expected behavior: Per the issue, a missing previews block should be treated as {} (the error text itself says the block "can be empty"), so wrangler preview should not fail with a missing-previews-block configuration error.
Observed behavior:wrangler preview exited 1 with the exact reported error: "[ERROR] Your Wrangler configuration is missing a previews block to run this command. Add the following to your configuration file: { "previews": {} } ... The block can be empty." Baseline with "previews": {} added removed that error entirely; the run then proceeded past config validation and failed on an unrelated sandbox limitation ("Could not determine Preview name. No git branch detected").
Artifact:⚠️ Publication failed; the reproduction result was preserved.
This summary was generated by an LLM and may contain errors. Please verify its findings.
Triage bot commands and options
Repository collaborators with write or admin access can trigger actions by commenting on this issue:
@workers-devprod reproduce: Attempt to reproduce the issue using its description and recent comments.
Thanks for the report. Wrangler deliberately requires a previews block before it creates a Preview, even an empty one, so "previews": {} is the expected setup for a Worker with no bindings. Treating a missing block as {} would be a change to Wrangler, which we track at cloudflare/workers-sdk#16889, so please follow and upvote it there.
Activity
workers-devprod commentedon Nov 6, 2026
Automated triage
Issue assessment
package:wrangler(high)product:previews(high)bug(medium)feature:workers-builds(medium)Actionability and missing information
wrangler preview (wrangler 4.158.0, Workers Builds) fails with 'Your Wrangler configuration is missing a previews block' for an assets-only Worker whose config omits the block; docs say the block can be empty and adding previews:{} fixes it. Versions, steps, and expected behavior are supplied.
Reproduction reason: The report describes current wrangler preview behavior with a concrete config scenario and error; running wrangler preview with an assets-only config lacking the previews block can verify it.
Reproduction
wrangler preview(mock Cloudflare API, dummy token) on an assets-only wrangler.json without apreviewsblock fails with the exact reported missing-previews-block error; adding the empty "previews": {} makes the error disappear.Evidence and attempted steps
Steps attempted:
cd /workspace/reproduction-output/project && pnpm install --ignore-scripts (pins wrangler@4.158.0)wrangler previewcommand (the command Workers Builds runs) against a local mock Cloudflare API, with wrangler.json lacking a previews blockpnpm reproduce (runs wrangler preview with CI=1, CLOUDFLARE_API_BASE_URL=http://127.0.0.1:<mock>, CLOUDFLARE_API_TOKEN=dummy, CLOUDFLARE_ACCOUNT_ID set)pnpm reproduce:baseline (node reproduce.mjs --with-previews-block)wrangler preview --ignore-base-config with dummy token and account idExpected behavior: Per the issue, a missing
previewsblock should be treated as {} (the error text itself says the block "can be empty"), sowrangler previewshould not fail with a missing-previews-block configuration error.Observed behavior:
wrangler previewexited 1 with the exact reported error: "[ERROR] Your Wrangler configuration is missing apreviewsblock to run this command. Add the following to your configuration file: { "previews": {} } ... The block can be empty." Baseline with "previews": {} added removed that error entirely; the run then proceeded past config validation and failed on an unrelated sandbox limitation ("Could not determine Preview name. No git branch detected").Artifact:⚠️ Publication failed; the reproduction result was preserved.
This summary was generated by an LLM and may contain errors. Please verify its findings.
Triage bot commands and options
Repository collaborators with write or admin access can trigger actions by commenting on this issue:
@workers-devprod reproduce: Attempt to reproduce the issue using its description and recent comments.workers-devprod commentedon Nov 13, 2026
Thanks for the report. Wrangler deliberately requires a
previewsblock before it creates a Preview, even an empty one, so"previews": {}is the expected setup for a Worker with no bindings. Treating a missing block as{}would be a change to Wrangler, which we track at cloudflare/workers-sdk#16889, so please follow and upvote it there.