wrangler deploy: Usage, Options & Common CI Errors
Deploy your Cloudflare Worker to the edge.
wrangler deploy publishes a Worker (and its bindings) to Cloudflare. In CI you authenticate with an API token via environment variables rather than the interactive OAuth login.
What it does
wrangler deploy bundles your Worker per wrangler.toml, uploads it to Cloudflare, and activates it on the configured routes or workers.dev subdomain, wiring up bindings (KV, R2, D1, secrets). It replaced the older wrangler publish command in Wrangler v3+.
Common usage
# Deploy using wrangler.toml
wrangler deploy
# Deploy to a named environment
wrangler deploy --env production
# CI: authenticate via env vars (no interactive login)
export CLOUDFLARE_API_TOKEN=xxxxxxxx
export CLOUDFLARE_ACCOUNT_ID=yyyyyyyy
wrangler deployCommon error in CI: not authenticated / account id missing
deploy fails with "You are not authenticated. Please run wrangler login" or "More than one account available - please set CLOUDFLARE_ACCOUNT_ID". CI cannot do the interactive OAuth flow. Fix: set CLOUDFLARE_API_TOKEN (a scoped token with Workers permissions) and CLOUDFLARE_ACCOUNT_ID as environment variables on the runner; wrangler picks them up automatically. Set account_id in wrangler.toml as an alternative to the env var.
Key options
| Option | Purpose |
|---|---|
| --env NAME | Deploy a named environment |
| --name NAME | Override the Worker name |
| --dry-run | Build without uploading |
| --minify | Minify the Worker bundle |