Astro Info
Astro v6.3.5
Vite v7.3.3
Node v24.11.0
System macOS (arm64)
Package Manager npm
Output static
Adapter @astrojs/cloudflare (v13.5.2)
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
The cloudflare adapter isn't fully compatible with astro:env.
Cloudflare's import { env } from "cloudflare:workers" (useable in workerd runtimes) correctly loads vars from the wrangler.jsonc, and the adapter is supposed to forward that env object to be used in Astro's astro:env API. See cloudflare integration code. For some unknown reason, variables that originated from the wrangler.jsonc aren't forwarded.
See related issue discussing what should be expected behavior.
Workaround: Import the env object from "cloudflare:workers" instead of "astro:env", or make variables available during build time and use astro:env.
What's the expected result?
Environment variables defined in the vars field of wrangler.jsonc and env.schema of astro.config.mjs should be importable from "astro:env/client" or "astro:env/server".
Link to Minimal Reproducible Example
https://github.com/alexanderdombroski/astro-cloudflare-env
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
The cloudflare adapter isn't fully compatible with astro:env.
Cloudflare's
import { env } from "cloudflare:workers"(useable inworkerdruntimes) correctly loadsvarsfrom thewrangler.jsonc, and the adapter is supposed to forward that env object to be used in Astro's astro:env API. See cloudflare integration code. For some unknown reason, variables that originated from thewrangler.jsoncaren't forwarded.See related issue discussing what should be expected behavior.
Workaround: Import the env object from "cloudflare:workers" instead of "astro:env", or make variables available during build time and use astro:env.
What's the expected result?
Environment variables defined in the
varsfield ofwrangler.jsoncandenv.schemaofastro.config.mjsshould be importable from "astro:env/client" or "astro:env/server".Link to Minimal Reproducible Example
https://github.com/alexanderdombroski/astro-cloudflare-env
Participation