Skip to content

Deployment management

By default, these operations create a version and deploy it to 100% of traffic:

You can upload a version without deploying it. This allows you to choose when to send traffic to it.

Deployment changes take up to a few seconds to reach every location on the network. Deploying to 100% of traffic does not make every location switch at once. A browser's HTML and asset requests can still use different versions. Refer to Version skew and static assets.

Upload a version without deploying

Via Wrangler

Use the wrangler versions upload command:

npx wrangler versions upload

Via the Cloudflare dashboard

  1. In the Cloudflare dashboard, go to the Workers & Pages page.

    Go to Workers & Pages ↗
  2. Select your Worker > Edit code.

  3. Make your changes, then select the down arrow next to Deploy > Save.

Deploy an uploaded version

Once you have uploaded a version, you can create a deployment that routes traffic to it.

Uploading a version does not add it to a deployment. To test it on your production hostname with a version override, add it to the deployment. You can set it to 0% of traffic. You can also turn on a Version URL to access the uploaded version separately.

Via Wrangler

Use the wrangler versions deploy command and follow the interactive prompts to select the version and set it to 100%:

npx wrangler versions deploy

You can also set the traffic percentage to less than 100% to start a gradual deployment.

Via the Cloudflare dashboard

  1. In the Cloudflare dashboard, go to the Workers & Pages page.

    Go to Workers & Pages ↗
  2. Select your Worker > Deployments.

  3. Select Promote deployment and choose the version you want to deploy.

Via Infrastructure as Code

You can also create versions and deployments directly with the API, library SDKs, and Terraform. Refer to Infrastructure as Code for examples.

In-flight requests

A deployment changes which versions receive new requests. Requests already executing can continue running the version that accepted them. Deploying new code does not update code in an invocation that has already started.

A successful deployment does not confirm that earlier invocations or their external operations have completed. If a release requires earlier work to finish, coordinate that in your application before making incompatible data or configuration changes.

Existing requests remain subject to the invocation duration rules and ctx.waitUntil() limits. The grace period for Workers runtime updates applies when Cloudflare updates the runtime, rather than when you deploy your code.

Durable Objects have separate code update behavior.

Limits

Deployments limit

You can only create a deployment with the last 100 uploaded versions of your Worker.

First upload

You must use C3 or wrangler deploy the first time you create a new Workers project. Using wrangler versions upload the first time you upload a Worker will fail.

Service worker syntax

Service worker syntax is not supported for versions that are uploaded through wrangler versions upload. You must use ES modules format.

Refer to Migrate from Service Workers to ES modules to learn how to migrate your Workers from the service worker format to the ES modules format.

Durable Object migrations

Uploading a version that changes Durable Object class lifecycle is not supported. This applies to both the declarative exports field and the legacy migrations array - any change that creates, deletes, renames, or transfers a Durable Object class must be applied through wrangler deploy.

Was this helpful?