Astro Info
Astro v5.14.5
Node v24.7.0
System macOS (arm64)
Package Manager npm
Output server
Adapter @astrojs/cloudflare
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Possible regression
I set .env.development and .env.production to contain CLOUDFLARE_ENV=dev and CLOUDFLARE_ENV=prod to utilise the env variables specified in my wrangler.jsonc { env: { dev: { vars: {... however when running astro with the cloudflare plugin it no longer picks up the variables in my wrangler config and I have to duplicate them into .env.development and .env.production to build the application.
This error appears
The following environment variables defined in env.schema are invalid:
(my example doesn't throw an error, just doesn't render the environment variable)
What's the expected result?
Cloudflare plugin should respect CLOUDFLARE_ENV as per https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/#combining-cloudflare-environments-and-vite-modes
It should utilise vars from the matching wrangler variable namespace and load those into the application based upon CLOUDFLARE_ENV setting and mode.
Link to Minimal Reproducible Example
https://github.com/calumpeak/env-repro
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Possible regression
I set
.env.developmentand.env.productionto containCLOUDFLARE_ENV=devandCLOUDFLARE_ENV=prodto utilise the env variables specified in my wrangler.jsonc{ env: { dev: { vars: {...however when running astro with the cloudflare plugin it no longer picks up the variables in my wrangler config and I have to duplicate them into.env.developmentand.env.productionto build the application.This error appears
The following environment variables defined inenv.schemaare invalid:(my example doesn't throw an error, just doesn't render the environment variable)
What's the expected result?
Cloudflare plugin should respect
CLOUDFLARE_ENVas per https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/#combining-cloudflare-environments-and-vite-modesIt should utilise vars from the matching wrangler variable namespace and load those into the application based upon
CLOUDFLARE_ENVsetting and mode.Link to Minimal Reproducible Example
https://github.com/calumpeak/env-repro
Participation