Repository navigation
Description
Existing documentation URL(s)
- https://developers.cloudflare.com/cf/projects/#deploy-a-prebuilt-build
- https://developers.cloudflare.com/cf/projects/#a-prebuilt-deploy-rejects-the-mode
- https://developers.cloudflare.com/cf/projects/cloudflare-config/#select-a-mode
What changes are you suggesting?
Explain that cf deploy --prebuilt can use Vite Build Output that records production without an explicit mode. Show an omitted-mode example and keep an explicit matching mode as an optional check. Replace the troubleshooting example for an omitted mode with guidance for an explicitly mismatched mode. Update the configuration page's reference to the same rule.
Additional information
Summary
The prebuilt deployment guide and its troubleshooting example describe --mode production as mandatory when a Vite build records production. The released CLI accepts that output without the flag and still rejects a conflicting explicit mode.
Steps to reproduce
With the CLI version below on PATH, run these commands in a scratch directory. After the build, all three dry runs use the same output.
cf init mode-docs-demo --package-manager npm
cd mode-docs-demo
cf build
jq '.buildContext.mode' .cloudflare/output/v1/config.json
cf deploy --dry-run --prebuilt
cf deploy --dry-run --prebuilt --mode production
cf deploy --dry-run --prebuilt --mode stagingExpected behavior
The documentation describes how validation works for this Vite build. Omitting the flag is valid, an explicit production matches, and an explicit staging conflicts with the recorded mode.
Actual behavior
The guide requires the explicit flag and shows an error for omitting it. The local build recorded production. The dry runs with the flag omitted and with --mode production both reached --dry-run: exiting now. and exited 0. The run with --mode staging reported that the output was created with production but the command requested staging, and exited 1. Verification used dry runs only.
Evidence
- Expected source: The CLI change that made the flag optional. In the release source,
uploadBuildOutputcallsvalidateBuildOutputModebefore resolving authentication for both regular deployments and dry runs. The validator returns when no mode is requested. - Failure source: The deployment and troubleshooting sections linked above, also present in
src/content/docs/cf/projects/index.mdxonproduction, compared with the three CLI outcomes above. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
Restoration check
Read the updated published guide and its linked configuration section against the three dry runs above. The documentation should allow the omitted and matching cases and explain the rejection of the mismatched case.
Runtime or environment
Linux x64, Node.js 26.13.1, cf 1.0.0-rc.1, and Build Output produced by @cloudflare/vite-plugin 2.0.0-rc.1. The docs were checked on production at 4efcbd4b00eaa602e9262144fea31cd852c49f59.
References
- [CLI] Correct cf docs to match current CLI behaviour #33871 — The earlier draft recorded that omission was accepted and left the guidance in place while treating the behavior as a possible CLI bug. The CLI change linked above confirms the behavior is intentional.
Triage assessment
- Impact level: P3
- Assessment status: supported
- Impact basis: The guide describes a validation error for an accepted command. Its example with the explicit matching flag still works.
- Workaround status: available
- Workaround basis: Both omitting the flag and passing the matching
--mode productionsucceeded in the dry run.
Activity