docs: add multi-environment Cloudflare deployment guide#13995
docs: add multi-environment Cloudflare deployment guide#13995lifeforcedev wants to merge 3 commits into
Conversation
Adds documentation for three-way matching requirement when deploying to multiple Cloudflare environments: - CLOUDFLARE_ENV environment variable - [env.<name>] section in wrangler.toml - platformProxy.environment in adapter config References: withastro/astro#15917, withastro/astro#16031, withastro#13897
- Add correct examples showing production and development matching - Add incorrect examples: name mismatch, missing platformProxy, deploy mismatch - Add hardcoded single-environment example - Move issue references to collapsible details section
…tion Keep docs concise with working solution. Extended examples (correct/incorrect patterns, issue references) moved to PR description for maintainers to cherry-pick.
✅ Deploy Preview for astro-docs-2 ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
Hello! Thank you for opening your first PR to Astro’s Docs! 🎉 Here’s what will happen next:
|
Summary
Adds documentation for the three-way matching requirement when deploying to multiple Cloudflare environments with
@astrojs/cloudflare.Environment
Tested with:
@astrojs/cloudflarev13.xnodejs_compatcompatibility flagWhat's Missing from Current Docs
The current docs mention
CLOUDFLARE_ENVbut don't explain:platformProxy: { environment: process.env.CLOUDFLARE_ENV }adapter config[env.<name>]section in wrangler.tomlChanges
Added "Multi-environment deployments with
platformProxy" section with:Extended Examples (for reference)
Correct: all three match
CLOUDFLARE_ENV=production— everything usesproduction:{ "env.production": { "name": "my-app-production", "kv_namespaces": [ { "binding": "SESSION", "id": "prod-kv-abc123" } ] }, "env.development": { "name": "my-app-dev", "kv_namespaces": [ { "binding": "SESSION", "id": "dev-kv-xyz789" } ] } }CLOUDFLARE_ENV=development— same config, different env:Incorrect:
CLOUDFLARE_ENVdoesn't match any[env.*]section{ "env.production": { ... }, "env.development": { ... } // No "env.staging" section }Incorrect:
platformProxymissing — Vite plugin ignoresCLOUDFLARE_ENVIncorrect:
wrangler deploy --envdoesn't match build envCorrect: hardcoded for single-environment projects
Sources
platformProxy.environmentoption docsCLOUDFLARE_ENVvariable docscloudflareEnvadapter optionRelated Issues
Closes #15917, #16031, #16040, #14540, #13897