Wrangler Configuration Now Supports Required Secrets Declaration
Key Points
- Declare required secrets in Wrangler configuration files
- Automatic validation during development and deployment
- Improved type generation for CI/CD environments
Summary
Cloudflare Workers now allows developers to explicitly declare required secrets in their Wrangler configuration files using a new secrets property. This enhancement improves secret management across local development, type generation, and deployment workflows.
Key Points
- Configuration: Add
secrets.requiredarray towrangler.tomlorwrangler.jsoncto specify mandatory secret names - Local Development:
wrangler devandvite devnow load only declared secrets from.dev.varsor.env, excluding undeclared keys - Type Generation:
wrangler typesgenerates typed bindings from configuration instead of inferring from local files, enabling CI/CD usage - Deployment Validation:
wrangler deployvalidates all required secrets exist before deployment, failing with clear error messages if missing - Environment Support: Per-environment secrets are supported with optional typing for secrets not present in all environments