Skip to content

Improve DX for Cloudflare Worker Enviroments #15917

Description

@asdfjkalsdfla

Astro Info

Astro                    v6.0.4
Node                     v24.13.1
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/cloudflare
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

n/a

Describe the Bug

Astro v6's Cloudflare adapter doesn't support environments and drops all environment specific settings.

In my project, I have a dev, staging, and prod environment. Each one has a unique route and KV store to back it. When I deploy, only the global values are being used even when I specify the environment. For example, I run pnpm wrangler deploy --env staging. I noticed that the generated wrangler.json file in dist/server/ doesn't include any of the environment settings from the original wrangler.jsonc file. It also has definedEnvironments so the deploy doesn't fail when running the deploy. This could cause accidental deployments depending on the setup.

What's the expected result?

I should be able to specify unique cloudflare environments and have them use unique URLs, etc....

Link to Minimal Reproducible Example

https://github.com/asdfjkalsdfla/astro-callous-chroma

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: has workaroundAn edge case that only affects very specific usage, but has a trivial workaround (priority)ecosystem: upstreamUpstream package has issuepkg: cloudflareRelated to the Cloudflare adapter

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions