[Resolved] Product Environment Variables not appearing in Cloudflare dashboard

I've got some environment variables for both preview and production envs in the wrangler.toml file of my pages application, but when deploy the application with wrangler, only the preview env vars are appearing in the cloudflare dash. Here are the contents of my wrangler.toml (private values obviously removed):
name = "hidden-name"
pages_build_output_dir = "./build/client"
compatibility_flags = [ "nodejs_compat" ]
compatibility_date = "2024-04-18"

[vars]
ENVIRONMENT = "development"
SERVER_URL = "hidden-url"

[env.preview.vars]
ENVIRONMENT = "preview"
SERVER_URL = "hidden-url"

[env.production.vars]
ENVIRONMENT = "production"
SERVER_URL = "hidden-url"
name = "hidden-name"
pages_build_output_dir = "./build/client"
compatibility_flags = [ "nodejs_compat" ]
compatibility_date = "2024-04-18"

[vars]
ENVIRONMENT = "development"
SERVER_URL = "hidden-url"

[env.preview.vars]
ENVIRONMENT = "preview"
SERVER_URL = "hidden-url"

[env.production.vars]
ENVIRONMENT = "production"
SERVER_URL = "hidden-url"
Does anybody have any suggestions as to why my Production environment variables are not showing up in the dashboard, whilst the Preview vars are? Thanks. Edit: These deployments are from a non-main branch... I'm now wondering if deploying a preview branch (and not the prod branch) is the reason these aren't being applied 🤔
No description
2 Replies
peeb
peebOP•5mo ago
Yup, answered my own question. I had to deploy the main branch for the production env vars in my wrangler.toml to be applied. I didn't spot anywhere in the docs where this was specified, but I guess I missed it. Question resolved!
No description
18/F/CALI
18/F/CALI•4mo ago
does [[env.preview.d1_databases]] and [[env.production.d1_databases]] work for you ? i am a little confused about this configuration. can you please guide me @peeb
Want results from more Discord servers?
Add your server