DashboardcraftCraft cloudflare target: ${VAR} expansi…

Craft cloudflare target: ${VAR} expansion guard misses API-inferred productionBranch

Category: gotcha
Confidence: 1.00
ID: 019f8443-d207-75e4-ae44-3caa7afb17b4
Project ID: e16af391-c497-4837-b681-c849a5514499
Cross-project: No
Recalled in other projects: 0
Source session: 034TaUm9363zGEG6E
Created: 2026-07-21 10:29:48
Updated: 2026-07-21 10:41:05

Content

Fixed (PR #843 follow-up): craft's config-time ${VAR} expansion guard for productionBranch originally only checked the literal string in user config — the API-inferred production branch (fetched at runtime from Cloudflare's Pages API and pushed into --branch) bypassed it entirely. Fix applied: extracted the regex into a reusable ENV_EXPANSION_REGEX constant and applied it inside resolveProductionBranch() to the resolved branch too, treating a match as unresolved (returns undefined, falls back to omitting --branch). Both the config-supplied and API-inferred paths are now checked symmetrically.

Move to: