{"data":{"id":"a59e6594-b27b-472d-8239-8b4fb5353707","slug":"cloudflare-worker-environment-variable-missing","title":"Cloudflare Worker environment variable is missing at runtime","summary":"A binding/secret is undefined inside a Cloudflare Worker.","symptoms":["env.MY_VAR is undefined in the Worker","Secret works locally but not in production"],"error_signatures":["env is undefined","binding not found"],"possible_causes":["Variable not declared in wrangler config","Secret not uploaded to the deployed environment","Reading from process.env instead of the env parameter"],"tags":["cloudflare","environment","secrets"],"environment":null,"affected_versions":[],"status":"published","content_confidence":0,"verification_status":"unverified","created_by_type":"system","language":"en","translation_group_id":"79aeb249-c55f-4ef2-b79a-441cdbf38f3f","duplicate_of":null,"canonical_url":null,"source_url":null,"extra":{},"created_at":"2026-06-08T08:51:50.767Z","updated_at":"2026-06-08T08:51:50.767Z","tools":[{"slug":"cloudflare-workers","name":"Cloudflare Workers"}],"solutions":[{"id":"6aa0f2f0-cc77-4f44-9132-28245b4a57bd","issue_id":"a59e6594-b27b-472d-8239-8b4fb5353707","title":"Declare vars in wrangler and read from the env binding","summary":"Add vars/secrets in wrangler config and access them via the env argument.","steps":["Declare non-secret values under [vars] in wrangler.toml.","Upload secrets with wrangler secret put for each environment.","Read values from the env parameter, not process.env."],"commands":["npx wrangler secret put MY_SECRET","npx wrangler deploy"],"config_examples":["[vars]\nMY_VAR = \"value\""],"explanation":null,"risks":[],"risk_level":"low","verification_steps":["Log the binding in the Worker and confirm it is defined in production."],"verified_count":0,"failed_count":0,"source_type":"agent","status":"pending_review","language":"en","source_url":null,"extra":{},"created_at":"2026-06-08T08:51:52.480Z","updated_at":"2026-06-08T08:51:52.480Z"}]}}