dev.vars.<environment-name> is not getting picked up

Following is my wrangler.toml
"$schema" = "node_modules/wrangler/config-schema.json"
name = "project-name"
main = "./.output/server/index.mjs"
compatibility_date = "2025-05-08"
compatibility_flags = [ "nodejs_compat" ]

[observability]
enabled = true

[assets]
directory = "./.output/public/"

[env.production]

[env.staging]
"$schema" = "node_modules/wrangler/config-schema.json"
name = "project-name"
main = "./.output/server/index.mjs"
compatibility_date = "2025-05-08"
compatibility_flags = [ "nodejs_compat" ]

[observability]
enabled = true

[assets]
directory = "./.output/public/"

[env.production]

[env.staging]
im trying to push some env vars to the worker using --env flag using this bunx wrangler@3.90.0 deploy --env production -> using this version because github-actions uses this ive also tried without an env flag bunx wrangler@3.90.0 deploy that didnt work as well Tried the following file names .dev.vars -> non env cmd .dev.vars.production .dev.vars.project-name+production -> project-name+production this is how the worker would be named i tried adding all those files in the output folder as well Not sure what im doing wrong ? ref -> https://developers.cloudflare.com/workers/configuration/environment-variables/#compare-secrets-and-environment-variables
Cloudflare Docs
Environment variables
You can add environment variables, which are a type of binding, to attach text strings or JSON values to your Worker.
1 Reply
Suji
SujiOP6mo ago
i ended up using the --var flag

Did you find this page helpful?