wrangler versions commands help you manage Worker Versions using Cloudflare’s Gradual Rollouts feature. Versions allow you to safely deploy changes by splitting traffic between multiple Worker versions.
Subcommands
wrangler versions view- View details of a specific versionwrangler versions list- List the 10 most recent versionswrangler versions upload- Upload your Worker code as a new versionwrangler versions deploy- Deploy versions by splitting trafficwrangler versions secret- Manage secrets for versioned Workers
Versions provide gradual rollout capabilities, allowing you to deploy new code incrementally and reduce risk. Changes to triggers (routes, custom domains, cron schedules) must be applied separately using
wrangler triggers deploy.view
View the details of a specific Worker Version including metadata, bindings, and configuration.Positional Arguments
The Worker Version ID to view (UUID format)
Options
Name of the Worker. Can also be specified in your configuration file.
Display output as clean JSON format instead of formatted text.
Example
Output
The command displays:- Version ID
- Creation timestamp
- Author email
- Source (Wrangler, Dashboard, API, or Terraform)
- Tag and message annotations (if set)
- Script handlers
- Compatibility date and flags
- Secrets (names only, not values)
- Bindings (KV, Durable Objects, R2, etc.)
list
List the 10 most recent Versions of your Worker, sorted by creation date.Options
Name of the Worker. Can also be specified in your configuration file.
Display output as clean JSON format.
Example
Output
For each version, displays:- Version ID
- Created timestamp
- Author email
- Source (how the version was created)
- Tag annotation
- Message annotation
upload
Upload your Worker code and configuration as a new Version without deploying it to production traffic.Positional Arguments
The path to an entry point for your Worker. If not specified, uses the
main field from your configuration file.Options
Name of the Worker.
A tag for this Worker Version (for organizational purposes).
A descriptive message for this Worker Version.
Name of an alias for this Worker version. Allows testing the version at a unique URL before deployment.
Date to use for compatibility checks. Required when uploading versions.
Flags to use for compatibility checks. Can be specified multiple times.
Use the latest version of the Workers runtime.
Static assets directory to be served. Replaces Workers Sites.
A key-value pair to be injected into the script as a variable. Format:
KEY:VALUE. Can be specified multiple times.A key-value pair to be substituted in the script at build time. Format:
KEY:VALUE. Can be specified multiple times.A module pair to be substituted in the script. Format:
OLD_MODULE:NEW_MODULE. Can be specified multiple times.The function that is called for each JSX element.
The function that is called for each JSX fragment.
Path to a custom tsconfig.json file.
Minify the Worker script.
Include source maps when uploading this Worker Version.
Skip internal build steps and directly upload Worker without bundling.
Output directory for the bundled Worker.
Output file for the bundled Worker.
Compile the project without actually uploading the version.
Example
Workflow
Bundle your Worker
Wrangler bundles your Worker code using esbuild (unless
--no-bundle is specified).Create version
The Worker code and configuration are uploaded as a new Version. The Version ID is returned.
After uploading a version, use
wrangler versions deploy to route traffic to it. Changes to triggers (routes, custom domains, cron schedules) are managed separately with wrangler triggers deploy.deploy
Safely roll out new Versions of your Worker by splitting traffic between multiple versions.Positional Arguments
Shorthand notation to deploy Worker Versions using format
<version-id>@<percentage>. Multiple versions can be specified. Example: abc123@50 def456@50Options
Name of the Worker.
Worker Version ID(s) to deploy. Can be specified multiple times.
Percentage of traffic to split between Worker Versions (0-100). Must match the order of version IDs. Can be specified multiple times.
Description of this deployment (optional).
Automatically accept defaults to prompts.Alias:
-yDon’t actually deploy, just validate the configuration.
Examples
Workflow
Review current deployment
Wrangler displays your current deployment showing which versions are receiving traffic.
Select versions
Choose which versions to deploy. You can select from:
- Versions in the current deployment
- The 10 most recently uploaded versions
- Specific versions provided as arguments
Set traffic percentages
Specify what percentage of traffic each version should receive. Percentages must total 100%.
Deploy
The deployment is created and traffic is immediately routed according to the specified percentages.
Container configuration changes (such as image, max_instances) are not gradually rolled out with versions. These changes only take effect after running
wrangler deploy.Traffic Distribution
You can specify traffic distribution in multiple ways:-
Shorthand notation:
-
Explicit flags:
-
Interactive mode:
Wrangler will prompt you to select versions and enter percentages.
secrets
Manage secrets for versioned Workers. When you modify a secret, a new version is automatically created.Subcommands
wrangler versions secret put <key>- Create or update a secretwrangler versions secret delete <key>- Delete a secretwrangler versions secret list- List secrets in deployed versionswrangler versions secret bulk <json>- Bulk upload secrets from JSON
Secrets are version-specific. When you create or update a secret, Wrangler creates a new version based on your latest uploaded version with the updated secret binding.
versions secret commands work similarly but create new versions instead of directly modifying the deployed Worker.
Related Commands
wrangler deployments- View deployment historywrangler rollback- Rollback to a previous versionwrangler deploy- Deploy without gradual rollouts
Configuration
Many options can be set in yourwrangler.json configuration file:
wrangler.json
Best Practices
Always test with preview URLs before deploying
Always test with preview URLs before deploying
Use
--preview-alias when uploading versions to test changes at a unique URL before routing production traffic.Use tags and messages for tracking
Use tags and messages for tracking
Roll out gradually
Roll out gradually
Start with a small percentage of traffic (e.g., 5-10%) when deploying a new version, then increase gradually:
Set compatibility_date in config
Set compatibility_date in config
Always specify
compatibility_date in your configuration file to ensure consistent runtime behavior across versions.