Cloudflare · tool · fg-0222
Wrangler deploy --env production ships without the vars, KV, or D1 bindings defined at the top level
env.DB is undefined in the production environment Worker
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
Cause
Bindings and vars are non inheritable keys in Wrangler config, so a named environment gets none of the top level values. Each environment needs its own copy.
Fix
Repeat vars and every binding block inside each [env.NAME] section, pointing at that environment's resources.
Apply
[env.production]
name = "my-worker-production"
vars = { API_HOST = "api.example.com" }
[[env.production.d1_databases]]
binding = "DB"
database_name = "prod-db"
database_id = "YOUR_DB_ID"Affects: Wrangler 3 and 4 with named environments, as of October 2026
Sources
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp