Skip to content

vite.define environment variables are not available in Cloudflare Pages #5234

@maxcountryman

Description

@maxcountryman

What version of astro are you using?

latest

Are you using an SSR adapter? If so, which one?

Cloudflare

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

The recommended approach for defining environment variables for Cloudflare Pages no longer works.

Variables defined in this manner are accessible locally or with wrangler preview but remain undefined when deployed to Cloudflare Pages. Note that environment variables have been defined via the Cloudflare Pages settings view of the CF dashboard and not via .def.vars.

Others have noted this method is no longer working.

Link to Minimal Reproducible Example

https://discord.com/channels/830184174198718474/1034300919820595241/1034300919820595241

Participation

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

Metadata

Metadata

Assignees

Labels

- P4: importantViolate documented behavior or significantly impacts performance (priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions