Dashboard › craft › Cloudflare Pages: use top-level product…
019f8443-d1fa-700a-85b8-a9a1a6c3136f| Project | Hits | Last recalled |
|---|---|---|
| institutional-transition-lab | 1 | 8d ago |
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).