Skip to content

update cloudflare adapter migration#13578

Open
alexanderniebuhr wants to merge 1 commit intomainfrom
explain-cloudflare-env-deployments
Open

update cloudflare adapter migration#13578
alexanderniebuhr wants to merge 1 commit intomainfrom
explain-cloudflare-env-deployments

Conversation

@alexanderniebuhr
Copy link
Member

Description (required)

This adds a missed behavior change in the Cloudflare migration guide about deploying to specific Cloudflare Environment.

Related issues & labels (optional)

  • Closes #
  • Suggested label:

@netlify
Copy link

netlify bot commented Mar 23, 2026

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 75c765d
🔍 Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/69c18ed15e328d000842979b
😎 Deploy Preview https://deploy-preview-13578--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@astrobot-houston
Copy link
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/integrations-guide/cloudflare.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Comment on lines +659 to +661
The new way to deploy to a specific Cloudflare Enviroment uses the `CLOUDFLARE_ENV` variable. A possible command would look like `CLOUDFLARE_ENV=some-env astro build && wrangler deploy`. The environment is baked in during build phase, so compared to before, you need to build your project separately for all the enviroments.

In the past you could build your Astro project once and deploy it to a specific Cloudflare Environment by using `wrangler deploy --env some-env`. Since the new version uses the Cloudflare Vite Plugin the behavior changed according to [Cloudflare's official migration guide](https://developers.cloudflare.com/workers/vite-plugin/reference/migrating-from-wrangler-dev/#cloudflare-environments). The only available option is using the `CLOUDFLARE_ENV` variable according to [Cloudflare's Vite Plugin Reference](https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/).
Copy link
Member

@ArmandPhilippot ArmandPhilippot Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Alex! I tried to reorganize a bit the content to follow the structure we usually use (ie. what was the previous behavior then what changed, and when). Feel free, to correct anything wrong (e.g. is this related to Astro 5/6 or is this specific to the adapter version?) and to make any adjustments about the wording. You're the Cloudflare expert here, not me. 😅

I moved one link to a ReadMore component, and remove the other because... I wasn't sure how to integrate it and it seems this link has a direct link to the other one and so, maybe this is enough. Feel free to push back if you think this was important!

Suggested change
The new way to deploy to a specific Cloudflare Enviroment uses the `CLOUDFLARE_ENV` variable. A possible command would look like `CLOUDFLARE_ENV=some-env astro build && wrangler deploy`. The environment is baked in during build phase, so compared to before, you need to build your project separately for all the enviroments.
In the past you could build your Astro project once and deploy it to a specific Cloudflare Environment by using `wrangler deploy --env some-env`. Since the new version uses the Cloudflare Vite Plugin the behavior changed according to [Cloudflare's official migration guide](https://developers.cloudflare.com/workers/vite-plugin/reference/migrating-from-wrangler-dev/#cloudflare-environments). The only available option is using the `CLOUDFLARE_ENV` variable according to [Cloudflare's Vite Plugin Reference](https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/).
In Astro 5.x, you could build your Astro project once and deploy it to a specific Cloudflare Environment with `wrangler deploy --env some-env`.
Since Astro 6.0, the integration relies on the Cloudflare Vite plugin and this behavior has changed. The environment is now baked during the build phase. Therefore, you must build your project separately for each environment.
To deploy to a specific Cloudflare environment, prefix your command with the `CLOUDFLARE_ENV` variable. For example, the command `CLOUDFLARE_ENV=some-env astro build && wrangler deploy` will build your Astro project and deploy it with Wrangler using the `some-env` environment.
<ReadMore>Learn how to update your [Cloudflare's environments in the Migrate from wrangler dev guide](https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/).</ReadMore>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants