DashboardcraftCloudflare Pages: use top-level product…

Cloudflare Pages: use top-level production_branch, not source.config.production_branch

Category: gotcha
Confidence: 0.90
ID: 019f8443-d1fa-700a-85b8-a9a1a6c3136f
Project ID: e16af391-c497-4837-b681-c849a5514499
Cross-project: No
Recalled in other projects: 1
Source session: 1FQVz3Xxdjkb2gFCo
Created: 2026-07-21 10:09:50
Updated: 2026-07-21 10:41:05

Cross-Project Recalls

ProjectHitsLast recalled
institutional-transition-lab 1 8d ago

Content

Trap: Cloudflare Pages GET /accounts/{id}/pages/projects/{name} returns both a top-level result.production_branch and a nested result.source.config.production_branch — the nested one looks authoritative but only describes the linked git repo's branch setting. Fix: wrangler's deploy2() reads the top-level field, comparing it to --branch to compute isProduction; any mismatch silently produces a preview deploy (no error). Craft's cloudflare target replicates this in resolveProductionBranch(): (1) use configured productionBranch if set; (2) else call the same GET via raw fetch to infer it — this needs no extra token scope beyond the Account → Cloudflare Pages → Edit scope deploy already requires (wrangler makes the same GET internally); (3) else omit --branch — a bare deploy from a non-git temp dir defaults to production. 404 (project not found) is a hard-fail via reportError; transient 5xx/network errors soft-fail (warn + omit --branch).

Move to: