Cloudflare Docs
Workers
Visit Workers on GitHub
Set theme to dark (⇧+D)

​​ Migrate from Wrangler 1

This document describes the steps to migrate a project from Wrangler 1 to Wrangler 2.

Wrangler 2 ships with new features and improvements that may require some changes to your configuration.

The CLI itself will guide you through the upgrade process.

​​ Update Wrangler version

​​ 1. Uninstall Wrangler 1

If you had previously installed Wrangler 1 globally using NPM, you can uninstall it with:

$ npm uninstall -g @cloudflare/wrangler

If you used Cargo to install Wrangler 1, you can uninstall it with:

$ cargo uninstall wrangler

​​ 2. Install Wrangler

Now, install the latest version of Wrangler.

$ npm install -g wrangler

​​ 3. Verify your install

To check that you have installed the correct Wrangler version, run:

$ wrangler --version

​​ Test Wrangler 2 on your previous projects

Now you will test that Wrangler 2 can build your Wrangler 1 project. In most cases, it will build just fine. If there are errors, the command line should instruct you with exactly what to change to get it to build.

If you would like to read more on the deprecated wrangler.toml fields that cause Wrangler 2 to error, refer to Deprecations.

Run the wrangler dev command. This will show any warnings or errors that should be addressed. Note that in most cases, the messages will include actionable instructions on how to resolve the issue.

$ wrangler dev
  • Errors need to be fixed before Wrangler can build your Worker.
  • In most cases, you will only see warnings. These do not stop Wrangler from building your Worker, but consider updating the configuration to remove them.

Here is an example of some warnings and errors:

⛅️ wrangler 2.0.0
-------------------------------------------------------
▲ [WARNING] Processing wrangler.toml configuration:
- 😶 Ignored: "type":
Most common features now work out of the box with wrangler, including modules, jsx,
typescript, etc. If you need anything more, use a custom build.
- Deprecation: "zone_id":
This is unnecessary since we can deduce this from routes directly.
- Deprecation: "build.upload.format":
The format is inferred automatically from the code.
✘ [ERROR] Processing wrangler.toml configuration:
- Expected "route" to be either a string, or an object with shape { pattern, zone_id | zone_name }, but got "".

​​ Deprecations

Refer to the deprecations guide for more details on what is no longer supported.