NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm, #4709 most downloaded on npm
Command-line interface for all things Cloudflare Workers
Latest stable
4.163.0
Last release today
16 Nov 2026
Ships on a steady schedule
a new release about every 8 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
4977 releases · first in 2012
Drag across the ruler to compare, or tap a release to open it.
Setting find_additional_modules to true in your configuration file will now instruct Wrangler to look for files in your base_dir that match your confi
#3726 7d20bdbd Thanks @petebacondarwin! - feat: support partial bundling with configurable external modules
Setting find_additional_modules to true in your configuration file will now instruct Wrangler to look for files in
your base_dir that match your configured rules, and deploy them as unbundled, external modules with your Worker.
base_dir defaults to the directory containing your main entrypoint.
Wrangler can operate in two modes: the default bundling mode and --no-bundle mode. In bundling mode, dynamic imports
(e.g. await import("./large-dep.mjs")) would be bundled into your entrypoint, making lazy loading less effective.
Additionally, variable dynamic imports (e.g. await import(`./lang/${language}.mjs`)) would always fail at runtime,
as Wrangler would have no way of knowing which modules to upload. The --no-bundle mode sought to address these issues
by disabling Wrangler's bundling entirely, and just deploying code as is. Unfortunately, this also disabled Wrangler's
code transformations (e.g. TypeScript compilation, --assets, --test-scheduled, etc).
With this change, we now additionally support partial bundling. Files are bundled into a single Worker entry-point file
unless find_additional_modules is true, and the file matches one of the configured rules. See
https://developers.cloudflare.com/workers/wrangler/bundling/ for more details and examples.
c71d8a0f Thanks @mrbbot! - chore: bump miniflare to 3.20231002.0#3726 7d20bdbd Thanks @petebacondarwin! - fix: ensure that additional modules appear in the out-dir
When using find_additional_modules (or no_bundle) we find files that
will be uploaded to be deployed alongside the Worker.
Previously, if an outDir was specified, only the Worker code was output
to this directory. Now all additional modules are also output there too.
#4067 31270711 Thanks @mrbbot! - fix: generate valid source maps with wrangler pages dev on macOS
On macOS, wrangler pages dev previously generated source maps with an
incorrect number of ../s in relative paths. This change ensures paths are
always correct, improving support for breakpoint debugging.
9a7559b6 Thanks @RamIdeas! - fix: respect the options.local value in unstable_dev (it was being ignored)807ab931 Thanks @mrbbot! - chore: bump miniflare to 3.20231002.1#3726 7d20bdbd Thanks @petebacondarwin! - fix: allow __STATIC_CONTENT_MANIFEST module to be imported anywhere
__STATIC_CONTENT_MANIFEST can now be imported in subdirectories when
--no-bundle or find_additional_modules are enabled.
1d0b7ad5 Thanks @JacksonKearl! - Fixed pages dev crashing and leaving port open when building a worker script fails#4066 c8b4a07f Thanks @RamIdeas! - fix: we no longer infer pathnames from route patterns as the host
During local development, inside your worker, the host of request.url is inferred from the routes in your config.
Previously, route patterns like "*/some/path/name" would infer the host as "some". We now handle this case and determine we cannot infer a host from such patterns.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Previously, wrangler pages dev attempted to send messages on a closed IPC channel when sources changed, resulting in an ERR_IPC_CHANNEL_CLOSED error.
6b1c327d Thanks @elithrar! - Fixed a bug in Vectorize that send preset configurations with the wrong key. This was patched on the server-side to work around this for users in the meantime.#4054 f8c52b93 Thanks @mrbbot! - fix: allow wrangler pages dev sessions to be reloaded
Previously, wrangler pages dev attempted to send messages on a closed IPC
channel when sources changed, resulting in an ERR_IPC_CHANNEL_CLOSED error.
This change ensures the channel stays open until the user exits wrangler pages dev.
Fixes the issue of a upload of a Secret when a Worker doesn't exist yet, the draft worker is created and the secret is uploaded to it.
3cd72862 Thanks @elithrar! - Adds wrangler support for Vectorize, Cloudflare's new vector database, with
wrangler vectorize. Visit the developer documentation
(https://developers.cloudflare.com/vectorize/) to learn more and create your
first vector database with wrangler vectorize create my-first-index.bde9d64a Thanks @ndisidore! - Adds Vectorize support uploading batches of newline delimited json (ndjson)
vectors from a source file.
Load a dataset with vectorize insert my-index --file vectors.ndjson#4028 d5389731 Thanks @JacobMGEvans! - fix: Bulk Secret Draft Worker
Fixes the issue of a upload of a Secret when a Worker doesn't exist yet, the draft worker is created and the secret is uploaded to it.
Fixes https://github.com/cloudflare/wrangler-action/issues/162
name = "ai-worker" main = "src/index.ts"
#3992 35564741 Thanks @edevil! - Add AI binding that will be used to interact with the AI project.
Example wrangler.toml
name = "ai-worker"
main = "src/index.ts"
[ai]
binding = "AI"
Example script:
import Ai from "@cloudflare/ai"
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const ai = new Ai(env.AI);
const story = await ai.run({
model: 'llama-2',
input: {
prompt: 'Tell me a story about the future of the Cloudflare dev platform'
}
});
return new Response(JSON.stringify(story));
},
};
export interface Env {
AI: any;
}
Previously, breakpoint debugging using Wrangler's DevTools was only supported in local mode, when using Wrangler's built-in bundler. This change exten
#3951 e0850ad1 Thanks @mrbbot! - feat: add support for breakpoint debugging to wrangler dev's --remote and --no-bundle modes
Previously, breakpoint debugging using Wrangler's DevTools was only supported
in local mode, when using Wrangler's built-in bundler. This change extends that
to remote development, and --no-bundle.
When using --remote and --no-bundle together, uncaught errors will now be
source-mapped when logged too.
#3951 e0850ad1 Thanks @mrbbot! - feat: add support for Visual Studio Code's built-in breakpoint debugger
Wrangler now supports breakpoint debugging with Visual Studio Code's debugger.
Create a .vscode/launch.json file with the following contents...
{
"configurations": [
{
"name": "Wrangler",
"type": "node",
"request": "attach",
"port": 9229,
"cwd": "/",
"resolveSourceMapLocations": null,
"attachExistingChildren": false,
"autoAttachChildProcesses": false
}
]
}
...then run wrangler dev, and launch the configuration.
bc88f0ec Thanks @dario-piotrowicz! - update wrangler pages dev D1 and DO descriptions#3928 95b24b1e Thanks @JacobMGEvans! - Colorize Deployed Bundle Size
Most bundlers, and other tooling that give you size outputs will colorize their the text to indicate if the value is within certain ranges.
The current range values are:
red 100% - 90%
yellow 89% - 70%
green <70%
resolves #1312
Wrangler R2 operations now support a -J flag that allows the user to specify a jurisdiction. When passing the -J flag, you will only be able to intera
#3775 3af30879 Thanks @bthwaites! - R2 Jurisdictional Restrictions guarantee objects in a bucket are stored within a specific jurisdiction. Wrangler now allows you to interact with buckets in a defined jurisdiction.
Wrangler R2 operations now support a -J flag that allows the user to specify a jurisdiction. When passing the -J flag, you will only be able to interact with R2 resources within that jurisdiction.
# List all of the buckets in the EU jurisdiction
wrangler r2 bucket list -J eu
# Downloads the object 'myfile.txt' from the bucket 'mybucket' in EU jurisdiction
wrangler r2 object get mybucket/myfile.txt -J eu
To access R2 buckets that belong to a jurisdiction from Workers, you will need to specify the jurisdiction as well as the bucket name as part of your bindings in your wrangler.toml:
[[r2_buckets]]
bindings = [
{ binding = "MY_BUCKET", bucket_name = "<YOUR_BUCKET_NAME>", jurisdiction = "<JURISDICTION>" }
]
a986f19f Thanks @DaniFoldi! - Only require preview_id and preview_bucket_name in remote dev modewrangler dev now supports breakpoint debugging in local mode! Press d to open DevTools and set breakpoints.
This will improve reliability when deploying to Cloudflare Pages
18dc7b54 Thanks @GregBrimble! - feat: Add internal wrangler pages project validate [directory] command which validates an asset directory### Patch Changes - #3752 `8f5ed7fe` Thanks @DaniFoldi! - Changed the binding type of WfP Dispatch Namespaces to DispatchNamespace * #3765 `e17d3096`
### Minor Changes - #3703 `e600f029` Thanks @jspspike! - Added --local option for r2 commands to interact with local persisted r2 objects * #3704 `8e2
e600f029 Thanks @jspspike! - Added --local option for r2 commands to interact with local persisted r2 objects8e231afd Thanks @JacobMGEvans! - secret:bulk exit 1 on failure
Previously secret"bulk would only log an error on failure of any of the upload requests.
Now when 'secret:bulk' has an upload request fail it throws an Error which sends an process.exit(1) at the root .catch() signal.
This will enable error handling in programmatic uses of secret:bulk.ff8603b6 Thanks @jspspike! - Added --local option for kv commands to interact with local persisted kv entriesc302bec6 Thanks @geelen! - Removing the D1 shim from the build process, in preparation for the Open Beta. D1 can now be used with --no-bundle enabled.6de3c5ec Thanks @dario-piotrowicz! - Added handling of .mjs files to be picked up by inside the Pages _worker.js directory
(currently only .js files are)no breaking changes for users relying on the default behavior, but some output changes exist when the new option is used, to indicate the change in be…
#3649 e2234bbc Thanks @JacobMGEvans! - Feature: 'stdin' support for 'secret:bulk'
Added functionality that allows for files and strings to be piped in, or other means of standard input. This will allow for a broader variety of use cases and improved DX.
This implementation is also fully backward compatible with the previous input method of file path to JSON.
# Example of piping in a file
> cat ./my-file.json | wrangler secret:bulk
# Example of piping in a string
> echo '{"key":"value"}' | wrangler secret:bulk
# Example of redirecting input from a file
> wrangler secret:bulk < ./my-file.json
f753f3af Thanks @1000hz! - chore: upgrade miniflare to 3.20230724.0#3610 bfbe49d0 Thanks @Skye-31! - Wrangler Capnp Compilation
This PR replaces logfwdr's schema property with a new unsafe.capnp object. This object accepts either a compiled_schema property, or a base_path and array of source_schemas to get Wrangler to compile the capnp schema for you.
#3579 d4450b0a Thanks @rozenmd! - fix: remove --experimental-backend from wrangler d1 migrations apply
This PR removes the need to pass a --experimental-backend flag when running migrations against an experimental D1 db.
Closes #3596
99baf58b Thanks @RamIdeas! - when running wrangler init -y ..., the -y flag is now passed to npx when delegating to C3#3668 99032c1e Thanks @rozenmd! - chore: make D1's experimental backend the default
This PR makes D1's experimental backend turned on by default.
#3579 d4450b0a Thanks @rozenmd! - feat: implement time travel for experimental d1 dbs
This PR adds two commands under wrangler d1 time-travel:
Use Time Travel to restore, fork or copy a database at a specific point-in-time.
Commands:
wrangler d1 time-travel info <database> Retrieve information about a database at a specific point-in-time using Time Travel.
Options:
--timestamp accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for [string]
--json return output as clean JSON [boolean] [default: false]
wrangler d1 time-travel restore <database> Restore a database back to a specific point-in-time.
Options:
--bookmark Bookmark to use for time travel [string]
--timestamp accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for [string]
--json return output as clean JSON [boolean] [default: false]
Closes #3577
#3384 ccc19d57 Thanks @Peter-Sparksuite! - feature: add wrangler deploy option: --old-asset-ttl [seconds]
wrangler deploy immediately deletes assets that are no longer current, which has a side-effect for existing progressive web app users of seeing 404 errors as the app tries to access assets that no longer exist.
This new feature:
Ensure wrangler dev watches the wrangler.toml file and reloads the server whenever configuration (e.g. KV namespaces, compatibility dates, etc) change
e72a5794 Thanks @mrbbot! - chore: upgrade miniflare to 3.20230717.0If a Worker is used as a service binding, a durable object namespace, an outbounds for a dynamic dispatch namespace, or a tail consumer, then deleting
#3426 5a74cb55 Thanks @matthewdavidrodgers! - Prefer non-force deletes unless a Worker is a dependency of another.
If a Worker is used as a service binding, a durable object namespace, an outbounds for a dynamic dispatch namespace, or a tail consumer, then deleting that Worker will break those existing ones that depend upon it. Deleting with ?force=true allows you to delete anyway, which is currently the default in Wrangler.
Force deletes are not often necessary, however, and using it as the default has unfortunate consequences in the API. To avoid them, we check if any of those conditions exist, and present the information to the user. If they explicitly acknowledge they're ok with breaking their other Workers, fine, we let them do it. Otherwise, we'll always use the much safer non-force deletes. We also add a "--force" flag to the delete command to skip the checks and confirmation and proceed with ?force=true
### Patch Changes - #3529 `bcdc1fe5` Thanks @jspspike! - Support https in wrangler dev local mode * #3541 `09f317d4` Thanks @GregBrimble! - chore: Bum
09f317d4 Thanks @GregBrimble! - chore: Bump miniflare@3.0.2c5f3bf45 Thanks @evanderkoogh! - Refactor dev-only checkedFetch check from a method substitution to a JavaScript Proxy to be able to support Proxied global fetch function.Prior to this PR, folks _had_ to console.log the error.cause property to understand why their D1 operations were failing. With this PR, error.cause wi
fddffdf0 Thanks @GregBrimble! - fix: Prevent wrangler pages dev from serving asset files outside of the build output directory#3414 6b1870ad Thanks @rozenmd! - fix: in D1, lift error.cause into the error message
Prior to this PR, folks had to console.log the error.cause property to understand why their D1 operations were failing. With this PR, error.cause will continue to work, but we'll also lift the cause into the error message.
a9349a89 Thanks @petebacondarwin! - fix: ensure that the script name is passed through to C3 from wrangler init5eef992f Thanks @RamIdeas! - wrangler init ... -y now delegates to C3 without prompts (respects the -y flag)4beac418 Thanks @rozenmd! - fix: add the number of read queries and write queries in the last 24 hours to the d1 info command#3454 a2194043 Thanks @mrbbot! - chore: upgrade miniflare to 3.0.1
This version ensures root CA certificates are trusted on Windows.
It also loads extra certificates from the NODE_EXTRA_CA_CERTS environment variable,
allowing wrangler dev to be used with Cloudflare WARP enabled.
e8df68ee Thanks @GregBrimble! - feat: Allow setting a D1 database ID when using wrangler pages dev by providing an optional =<ID> suffix to the argument like --d1 BINDING_NAME=database-idFixes a regression in wrangler@3.x, where wrangler pages dev --script-path= -- would start throwing esbuild errors.
4a88db32 Thanks @petebacondarwin! - feat: add wrangler pages project delete command#3399 d8a9995b Thanks @Skye-31! - Fix: wrangler pages dev --script-path argument when using a proxy command instead of directory mode
Fixes a regression in wrangler@3.x, where wrangler pages dev --script-path=<my script path> -- <proxy command> would start throwing esbuild errors.
116d3fd9 Thanks @Maximo-Guk! - Fix: Avoid unnecessary rebuilding pages functions in wrangler pages devd5a230f1 Thanks @elithrar! - Fixed wrangler d1 migrations to use --experimental-backend and not --experimentalBackend so that it is consistent with wrangler d1 create.55703e52 Thanks @rozenmd! - fix: wrangler rollback shouldn't print its warning in the global menu#3124 2956c31d Thanks @verokarhu! - fix: failed d1 migrations not treated as errors
This PR teaches wrangler to return a non-success exit code when a set of migrations fails.
It also cleans up wrangler d1 migrations apply output significantly, to only log information relevant to migrations.
b5b46b4a Thanks @shahsimpson! - Prevents uploads with both cron triggers and smart placement enabled27b5aec5 Thanks @rozenmd! - This PR implements a trimmer that removes BEGIN TRANSACTION/COMMIT from SQL files sent to the API (since the D1 API already wraps SQL in a transaction for users).#3324 ed9fbf79 Thanks @rozenmd! - add d1 info command for people to check DB size
This PR adds a d1 info <NAME> command for getting information about a D1 database, including the current database size and state.
Usage:
> npx wrangler d1 info northwind
┌───────────────────┬──────────────────────────────────────┐
│ │ d5b1d127-xxxx-xxxx-xxxx-cbc69f0a9e06 │
├───────────────────┼──────────────────────────────────────┤
│ name │ northwind │
├───────────────────┼──────────────────────────────────────┤
│ version │ beta │
├───────────────────┼──────────────────────────────────────┤
│ num_tables │ 13 │
├───────────────────┼──────────────────────────────────────┤
│ file_size │ 33.1 MB │
├───────────────────┼──────────────────────────────────────┤
│ running_in_region │ WEUR │
└───────────────────┴──────────────────────────────────────┘
> npx wrangler d1 info northwind --json
{
"uuid": "d5b1d127-xxxx-xxxx-xxxx-cbc69f0a9e06",
"name": "northwind",
"version": "beta",
"num_tables": 13,
"file_size": 33067008,
"running_in_region": "WEUR"
}
### Patch Changes - #3277 `99e6ccf5` Thanks @RamIdeas! - fix: remove extraneous arg when wrangler delegates to c3
This also avoids confusion with the similar but very different npm publish command. wrangler publish will remain a deprecated alias for now, but will…
#3197 3b3fadfa Thanks @mrbbot! - feature: rename wrangler publish to wrangler deploy
This ensures consistency with other messaging, documentation and our dashboard,
which all refer to deployments. This also avoids confusion with the similar but
very different npm publish command. wrangler publish will remain a
deprecated alias for now, but will be removed in the next major version of Wrangler.
#3197 bac9b5de Thanks @mrbbot! - feature: enable local development with Miniflare 3 and workerd by default
wrangler dev now runs fully-locally by default, using the open-source Cloudflare Workers runtime workerd.
To restore the previous behaviour of running on a remote machine with access to production data, use the new --remote flag.
The --local and --experimental-local flags have been deprecated, as this behaviour is now the default, and will be removed in the next major version.
#3197 02a672ed Thanks @mrbbot! - feature: enable persistent storage in local mode by default
Wrangler will now persist local KV, R2, D1, Cache and Durable Object data
in the .wrangler folder, by default, between reloads. This persistence
directory can be customised with the --persist-to flag. The --persist flag
has been removed, as this is now the default behaviour.
#3197 dc755fdc Thanks @mrbbot! - feature: remove delegation to locally installed versions
Previously, if Wrangler was installed globally and locally within a project,
running the global Wrangler would instead invoke the local version.
This behaviour was contrary to most other JavaScript CLI tools and has now been
removed. We recommend you use npx wrangler instead, which will invoke the
local version if installed, or install globally if not.
#3197 24e1607a Thanks @mrbbot! - chore: remove unused files from published package
Specifically, the src and miniflare-config-stubs directories have been removed.
f1b8a1cc Thanks @matthewdavidrodgers! - Support outbounds for dispatch_namespace bindingse1e5d782 Thanks @mrbbot! - feature: add warning when trying to use wrangler dev inside a WebContainer41fc45c2 Thanks @matthewdavidrodgers! - Support tail_consumers in script upload#3157 4d7781f7 Thanks @edevil! - [wrangler] feat: Support for Constellation bindings
Added support for a new type of safe bindings called "Constellation" that allows interacting with uploaded models in the context of these projects.
[[constellation]]
binding = 'AI'
project_id = '9d478427-dea6-4988-9b16-f6f8888d974c'
#3135 cc2adc2e Thanks @edevil! - [wrangler] feat: Support for Browser Workers
These bindings allow one to use puppeteer to control a browser in a worker script.
561b962f Thanks @GregBrimble! - fix: _worker.js/ directory support for dynamically imported chunks in wrangler pages dev#3186 3050ce7f Thanks @petebacondarwin! - fix: ensure pages _routes.json emulation in dev command handles .s and *s
Fixes #3184
#3048 6ccc4fa6 Thanks @oustn! - Fix: fix local registry server closed
Closes #1920. Sometimes start the local dev server will kill
the devRegistry server so that the devRegistry server can't be used. We can listen the devRegistry server close event
and reset server to null. When registerWorker is called, we can check if the server is null and start a new server.
#3001 f9722873 Thanks @rozenmd! - fix: make it possible to create a D1 database backed by the experimental backend, and make d1 execute's batch size configurable
With this PR, users will be able to run wrangler d1 create <NAME> --experimental-backend to create new D1 dbs that use an experimental backend. You can also run wrangler d1 migrations apply <NAME> experimental-backend to run migrations against an experimental database.
On top of that, both wrangler d1 migrations apply <NAME> and wrangler d1 execute <NAME> now have a configurable batch-size flag, as the experimental backend can handle more than 10000 statements at a time.
#3153 1b67a405 Thanks @edevil! - [wrangler] fix: constellation command help
Changed name to projectName in some Constellation commands that interacted with projects. Also added the possibility to specify a model description when uploading it.
88ff9d7d Thanks @rozenmd! - feat: (alpha) - make it possible to give D1 a hint on where it should create the database561b962f Thanks @GregBrimble! - fix: _worker.js/ directory support for D1 bindingsNothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Allows a placement object in the wrangler config with a mode of off or smart to configure Smart placement. Enabling Smart Placement can be done in you
e351afcf Thanks @GregBrimble! - feat: Add support for the undocumented _worker.js/ directory in Pages#3095 133c0423 Thanks @zebp! - feat: add support for placement in wrangler config
Allows a placement object in the wrangler config with a mode of off or smart to configure Smart placement. Enabling Smart Placement can be done in your wrangler.toml like:
[placement]
mode = "smart"
#3140 5fd080c8 Thanks @penalosa! - feat: Support sourcemaps in DevTools
Intercept requests from DevTools in Wrangler to inject sourcemaps and enable folders in the Sources Panel of DevTools. When errors are thrown in your Worker, DevTools should now show your source file in the Sources panel, rather than Wrangler's bundled output.
#2912 5079f476 Thanks @petebacondarwin! - fix: do not render "value of stdout.lastframe() is undefined" if the output is an empty string
Fixes #2907
d0788008 Thanks @dario-piotrowicz! - fix pages building not taking into account the nodejs_compat flag (and improve the related error message)### Minor Changes - #3091 `c32f514c` Thanks @edevil! - Added initial commands for integrating with Constellation AI.
Wrangler no longer buffers all assets into memory before uploading. This should prevent out-of-memory errors when publishing sites with many large fil
8818f551 Thanks @mrbbot! - fix: improve Workers Sites asset upload reliability
Too many bulk operations already in progress error.WRANGLER_LOG=debug environment variable. A splash of colour has also been added.This PR lets you search Cloudflare's entire docs via wrangler docs [search term here].
#3004 6d5000a7 Thanks @rozenmd! - feat: teach wrangler docs to use algolia search index
This PR lets you search Cloudflare's entire docs via wrangler docs [search term here].
By default, if the search fails to find what you're looking for, you'll get an error like this:
✘ [ERROR] Could not find docs for: <search term goes here>. Please try again with another search term.
If you provide the --yes or -y flag, wrangler will open the docs to https://developers.cloudflare.com/workers/wrangler/commands/, even if the search fails.
Notably, this adds native support for Windows to wrangler dev --experimental-local, logging for incoming requests, and support for a bunch of newer R2
#3058 1bd50f56 Thanks @mrbbot! - chore: upgrade miniflare@3 to 3.0.0-next.13
Notably, this adds native support for Windows to wrangler dev --experimental-local, logging for incoming requests, and support for a bunch of newer R2 features.
#3058 1bd50f56 Thanks @mrbbot! - fix: disable persistence without --persist in --experimental-local
This ensures --experimental-local doesn't persist data on the file-system, unless the --persist flag is set.
Data is still always persisted between reloads.
#3055 5f48c405 Thanks @rozenmd! - fix: Teach D1 commands to read auth configuration from wrangler.toml
This PR fixes a bug in how D1 handles a user's accounts. We've updated the D1 commands to read from config (typically via wrangler.toml) before trying to run commands. This means if an account_id is defined in config, we'll use that instead of erroring out when there are multiple accounts to pick from.
Fixes #3046
### Patch Changes - #2783 `4c55baf9` Thanks @GregBrimble! - feat: Add /*.wasm?module as default module rule (alias of /*.wasm) * #2989 `86e942bb` Than
4c55baf9 Thanks @GregBrimble! - feat: Add **/*.wasm?module as default module rule (alias of **/*.wasm)86e942bb Thanks @GregBrimble! - fix: Durable Object proxying websockets over local dev registryWhen the --no-bundle flag is set, Wrangler now has support for uploading additional modules alongside the entrypoint. This will allow modules to be im
#2769 0a779904 Thanks @penalosa! - feature: Support modules with --no-bundle
When the --no-bundle flag is set, Wrangler now has support for uploading additional modules alongside the entrypoint. This will allow modules to be imported at runtime on Cloudflare's Edge. This respects Wrangler's module rules configuration, which means that only imports of non-JS modules will trigger an upload by default. For instance, the following code will now work with --no-bundle (assuming the example.wasm file exists at the correct path):
// index.js
import wasm from './example.wasm'
export default {
async fetch() {
await WebAssembly.instantiate(wasm, ...)
...
}
}
For JS modules, it's necessary to specify an additional module rule (or rules) in your wrangler.toml to configure your modules as ES modules or Common JS modules. For instance, to upload additional JavaScript files as ES modules, add the following module rule to your wrangler.toml, which tells Wrangler that all **/*.js files are ES modules.
rules = [
{ type = "ESModule", globs = ["**/*.js"]},
]
If you have Common JS modules, you'd configure Wrangler with a CommonJS rule (the following rule tells Wrangler that all .cjs files are Common JS modules):
rules = [
{ type = "CommonJS", globs = ["**/*.cjs"]},
]
In most projects, adding a single rule will be sufficient. However, for advanced usecases where you're mixing ES modules and Common JS modules, you'll need to use multiple rule definitions. For instance, the following set of rules will match all .mjs files as ES modules, all .cjs files as Common JS modules, and the nested/say-hello.js file as Common JS.
rules = [
{ type = "CommonJS", globs = ["nested/say-hello.js", "**/*.cjs"]},
{ type = "ESModule", globs = ["**/*.mjs"]}
]
If multiple rules overlap, Wrangler will log a warning about the duplicate rules, and will discard additional rules that matches a module. For example, the following rule configuration classifies dep.js as both a Common JS module and an ES module:
rules = [
{ type = "CommonJS", globs = ["dep.js"]},
{ type = "ESModule", globs = ["dep.js"]}
]
Wrangler will treat dep.js as a Common JS module, since that was the first rule that matched, and will log the following warning:
▲ [WARNING] Ignoring duplicate module: dep.js (esm)
This also adds a new configuration option to wrangler.toml: base_dir. Defaulting to the directory of your Worker's main entrypoint, this tells Wrangler where your additional modules are located, and determines the module paths against which your module rule globs are matched.
For instance, given the following directory structure:
- wrangler.toml
- src/
- index.html
- vendor/
- dependency.js
- js/
- index.js
If your wrangler.toml had main = "src/js/index.js", you would need to set base_dir = "src" in order to be able to import src/vendor/dependency.js and src/index.html from src/js/index.js.
#2957 084b2c58 Thanks @esimons! - fix: Respect querystring params when calling .fetch on a worker instantiated with unstable_dev
Previously, querystring params would be stripped, causing issues for test cases that depended on them. For example, given the following worker script:
export default {
fetch(req) {
const url = new URL(req.url);
const name = url.searchParams.get("name");
return new Response("Hello, " + name);
},
};
would fail the following test case:
const worker = await unstable_dev("script.js");
const res = await worker.fetch("http://worker?name=Walshy");
const text = await res.text();
expect(text).toBe("Hello, Walshy");
#2840 e311bbbf Thanks @mrbbot! - fix: make WRANGLER_LOG case-insensitive, warn on unexpected values, and fallback to log if invalid
Previously, levels set via the WRANGLER_LOG environment-variable were case-sensitive.
If an unexpected level was set, Wrangler would fallback to none, hiding all logs.
The fallback has now been switched to log, and lenient case-insensitive matching is used when setting the level.
eebad0d9 Thanks @kuba-orlik! - fix: allow programmatic dev workers to be stopped and started in a single session3f7a75cc Thanks @JacobMGEvans! - Fix: Generate Remote URL
Previous URL was pointing to the old cloudflare/templates repo,
updated the URL to point to templates in the workers-sdk monorepo.Support send email bindings in order to send emails from a worker. There are three types of bindings:
#2914 9af1a640 Thanks @edevil! - feat: add support for send email bindings
Support send email bindings in order to send emails from a worker. There are three types of bindings:
#2931 5f6c4c0c Thanks @Skye-31! - Fix: Pages Dev incorrectly allowing people to turn off local mode
Local mode is not currently supported in Pages Dev, and errors when people attempt to use it. Previously, wrangler hid the "toggle local mode" button when using Pages dev, but this got broken somewhere along the line.
Going forward Workers will be providing built-in modules (similar to node:...) that can be imported using the cloudflare:... prefix. This change adds
#2905 6fd06241 Thanks @edevil! - feat: support external imports from cloudflare:... prefixed modules
Going forward Workers will be providing built-in modules (similar to node:...) that can be imported using the cloudflare:... prefix. This change adds support to the Wrangler bundler to mark these imports as external.
163dccf4 Thanks @jspspike@gmail.com! - feature: add wrangler deployment view and wrangler rollback subcommandswrangler deployments view [deployment-id] will get the details of a deployment, including bindings and usage model information.
This information can be used to help debug bad deployments.
wrangler rollback [deployment-id] will rollback to a specific deployment in the runtime. This will be useful in situations like recovering from a bad
deployment quickly while resolving issues. If a deployment id is not specified wrangler will rollback to the previous deployment. This rollback only changes the code in the runtime and doesn't affect any code or configurations
in a developer's local setup.
wrangler deployments list will list the 10 most recent deployments. This command originally existed as wrangler deployments
example of view <deployment-id> output:
Deployment ID: 07d7143d-0284-427e-ba22-2d5e6e91b479
Created on: 2023-03-02T21:05:15.622446Z
Author: jspspike@gmail.com
Source: Upload from Wrangler 🤠
------------------------------------------------------------
Author ID: e5a3ca86e08fb0940d3a05691310bb42
Usage Model: bundled
Handlers: fetch
Compatibility Date: 2022-10-03
--------------------------bindings--------------------------
[[r2_buckets]]
binding = "MY_BUCKET"
bucket_name = "testr2"
[[kv_namespaces]]
id = "79300c6d17eb4180a07270f450efe53f"
binding = "yeee"
#2859 ace46939 Thanks @jbwcloudflare! - feature: add support for Queue Consumer concurrency
Consumer concurrency allows a consumer Worker processing messages from a queue to automatically scale out horizontally in order to keep up with the rate that messages are being written to a queue.
The new max_concurrency setting can be used to limit the maximum number of concurrent consumer Worker invocations.
#2838 9fa6b167 Thanks @mrbbot! - fix: display cause when local D1 migrations fail to apply
Previously, if wrangler d1 migrations apply --local failed, you'd see something like:
❌ Migration 0000_migration.sql failed with following Errors
┌──────────┐
│ Error │
├──────────┤
│ D1_ERROR │
└──────────┘
We'll now show the SQLite error that caused the failure:
❌ Migration 0000_migration.sql failed with following Errors
┌───────────────────────────────────────────────┐
│ Error │
├───────────────────────────────────────────────┤
│ Error: SqliteError: unknown database "public" │
└───────────────────────────────────────────────┘
This PR makes it possible to query D1 from an Email Worker, assuming a binding has been setup.
e33bea9b Thanks @WalshyDev! - Changed console.debug for logger.debug in Pages uploading. This will ensure the debug logs are only sent when debug logging is enabled with WRANGLER_LOG=debug.### Patch Changes - #2873 `5bcc333d` Thanks @GregBrimble! - fix: Prevent compile loop when using _worker.js and wrangler pages dev
5bcc333d Thanks @GregBrimble! - fix: Prevent compile loop when using _worker.js and wrangler pages devThis deprecates --outfile when building a Pages Plugin with --plugin.
#2839 ad4b123b Thanks @mrbbot! - fix: remove vitest from wrangler init's generated tsconfig.json types array
Previously, wrangler init generated a tsconfig.json with "types": ["@cloudflare/workers-types", "vitest"], even if Vitest tests weren't generated.
Unlike Jest, Vitest doesn't provide global APIs by default, so there's no need for ambient types.
8d462c0c Thanks @GregBrimble! - chore: Remove the --experimental-worker-bundle option from Pages Functionse3c036d7 Thanks @Cyb3r-Jak3! - feature: include .wrangler directory in gitignore template used with wrangler init#2806 8d462c0c Thanks @GregBrimble! - feat: Add --outdir as an option when running wrangler pages functions build.
This deprecates --outfile when building a Pages Plugin with --plugin.
When building functions normally, --outdir may be used to produce a human-inspectable format of the _worker.bundle that is produced.
#2806 8d462c0c Thanks @GregBrimble! - Enable bundling in Pages Functions by default.
We now enable bundling by default for a functions/ folder and for an _worker.js in Pages Functions. This allows you to use external modules such as Wasm. You can disable this behavior in Direct Upload projects by using the --no-bundle argument in wrangler pages publish and wrangler pages dev.
#2836 42fb97e5 Thanks @GregBrimble! - fix: preserve the entrypoint filename when running wrangler publish --outdir <dir>.
Previously, this entrypoint filename would sometimes be overwritten with some internal filenames. It should now be based off of the entrypoint you provide for your Worker.
#2828 891ddf19 Thanks @GregBrimble! - fix: Bring pages dev logging in line with dev proper's
wrangler pages dev now defaults to logging at the log level (rather than the previous warn level), and the pages prefix is removed.
#2855 226e63fa Thanks @GregBrimble! - fix: --experimental-local with wrangler pages dev
We previously had a bug which logged an error (local worker: TypeError: generateASSETSBinding2 is not a function). This has now been fixed.
Notably, this brings the following improvements to wrangler dev --experimental-local:
#2810 62784131 Thanks @mrbbot! - chore: upgrade @miniflare/tre to 3.0.0-next.12, incorporating changes from 3.0.0-next.11
Notably, this brings the following improvements to wrangler dev --experimental-local:
better-sqlite3@8, allowing installation on Node 194756d6a1 Thanks @alankemp! - Add new [unsafe.metadata] section to wrangler.toml allowing arbitary data to be added to the metadata section of the upload#2539 3725086c Thanks @GregBrimble! - feat: Add support for the nodejs_compat Compatibility Flag when bundling a Worker with Wrangler
This new Compatibility Flag is incompatible with the legacy --node-compat CLI argument and node_compat configuration option. If you want to use the new runtime Node.js compatibility features, please remove the --node-compat argument from your CLI command or your config file.
### Patch Changes - #2795 `ec3e181e` Thanks @penalosa! - fix: Adds a duplex: "half" property to R2 fetch requests with stream bodies in order to be co
ec3e181e Thanks @penalosa! - fix: Adds a duplex: "half" property to R2 fetch requests with stream bodies in order to be compatible with undici v5.204ca8c0b0 Thanks @GregBrimble! - fix: Support overriding the next URL in subsequent executions with next("/new-path") from within a Pages PluginThis will look something like the following, where a request to /users/123 will appear as that in the browser, but will internally go to /users/[id].h
a9adfbe7 Thanks @penalosa! - Previously, wrangler dev would not work if the root of your zone wasn't behind Cloudflare. This behaviour has changed so that now only the route which your Worker is exposed on has to be behind Cloudflare.#2708 b3346cfb Thanks @Skye-31! - Feat: Pages now supports Proxying (200 status) redirects in it's _redirects file
This will look something like the following, where a request to /users/123 will appear as that in the browser, but will internally go to /users/[id].html.
/users/:id /users/[id] 200
#2766 7912e63a Thanks @mrbbot! - fix: correctly detect service-worker format when using typeof module
Wrangler automatically detects whether your code is a modules or service-worker format Worker based on the presence of a default export. This check currently works by building your entrypoint with esbuild and looking at the output metafile.
Previously, we were passing format: "esm" to esbuild when performing this check, which enables format conversion. This may introduce export default into the built code, even if it wasn't there to start with, resulting in incorrect format detections.
This change removes format: "esm" which disables format conversion when bundling is disabled. See https://esbuild.github.io/api/#format for more details.
#2780 80f1187a Thanks @GregBrimble! - fix: Ensure we don't mangle internal constructor names in the wrangler bundle when building with esbuild
Undici changed how they referenced FormData, which meant that when used in our bundle process, we were failing to upload multipart/form-data bodies. This affected wrangler pages publish and wrangler publish.
#2720 de0cb57a Thanks @JacobMGEvans! - Fix: Upgraded to ES2022 for improved compatibility
Upgraded worker code target version from ES2020 to ES2022 for better compatibility and unblocking of a workaround related to issue #2029. The worker runtime now uses the same V8 version as recent Chrome and is 99% ES2016+ compliant. The only thing we don't support on the Workers runtime, the remaining 1%, is the ES2022 RegEx feature as seen in the compat table for the latest Chrome version.
Compatibility table: https://kangax.github.io/compat-table/es2016plus/
4ede044e Thanks @mrbbot! - chore: upgrade miniflare to 2.12.1 and @miniflare/tre to 3.0.0-next.10Functionality implemented first as an api, which is used in the cli standard api commands
#2567 02ea098e Thanks @matthewdavidrodgers! - Add mtls-certificate commands and binding support
Functionality implemented first as an api, which is used in the cli standard api commands
Note that this adds a new OAuth scope, so OAuth users will need to log out and log back in to use the new 'mtls-certificate' commands However, publishing with mtls-certifcate bindings (bindings of type 'mtls_certificate') will work without the scope.
c5943c9f Thanks @mrbbot! - Upgrade miniflare to 2.12.0, including support for R2 multipart upload bindings, the nodejs_compat compatibility flag, D1 fixes and more!#2579 bf558bdc Thanks @JacobMGEvans! - Added additional fields to the output of wrangler deployments command. The additional fields are from the new value in the response annotations which includes workers/triggered_by and rollback_from
Example:
Deployment ID: Galaxy-Class
Created on: 2021-01-04T00:00:00.000000Z
Trigger: Upload from Wrangler 🤠
Rollback from: MOCK-DEPLOYMENT-ID-2222
#2624 882bf592 Thanks @CarmenPopoviciu! - Add wasm support in wrangler pages publish
Currently it is not possible to import wasm modules in either Pages
Functions or Pages Advanced Mode projects.
This commit caries out work to address the aforementioned issue by
enabling wasm module imports in wrangler pages publish. As a result,
Pages users can now import their wasm modules withing their Functions
or _worker.js files, and wrangler pages publish will correctly
bundle everything and serve these "external" modules.
68a2a19e Thanks @mrbbot! - Fix internal middleware system to allow D1 databases and --test-scheduled to be used together58ac8a78 Thanks @dario-piotrowicz! - fix: make sure that the pages publish --no-bundle flag is correctly recognized4bc78470 Thanks @rozenmd! - fix: don't throw an error when omitting preview_database_id, warn instead2b1177ad Thanks @CarmenPopoviciu! - You can now import Wasm modules in Pages Functions and Pages Functions Advanced Mode (_worker.js).
This change specifically enables wasm module imports in wrangler pages functions build.
As a result, Pages users can now import their wasm modules within their Functions or
_worker.js files, and wrangler pages functions build will correctly bundle everything
and output the expected result file.### Patch Changes - #2652 `2efd4537` Thanks @mrkldshv! - fix: change jest to vitest types in generated TypeScript config * #2657 `8d21b2ea` Thanks @ro
This can be used to build isomorphic libraries that have different implementations depending on the JavaScript runtime they're running in. When bundli
#2629 151733e5 Thanks @mrbbot! - Prefer the workerd exports condition when bundling.
This can be used to build isomorphic libraries that have different implementations depending on the JavaScript runtime they're running in.
When bundling, Wrangler will try to load the workerd key.
This is the standard key for the Cloudflare Workers runtime.
Learn more about the conditional exports field here.
89d78c0a Thanks @penalosa! - Wrangler now supports an --experimental-json-config flag which will read your configuration from a wrangler.json file, rather than wrangler.toml. The format of this file is exactly the same as the wrangler.toml configuration file, except that the syntax is JSONC (JSON with comments) rather than TOML. This is experimental, and is not recommended for production use.04d8a312 Thanks @dario-piotrowicz! - fix d1 directory not being created when running the wrangler d1 execute command with the --yes/-y flag70daffeb Thanks @dario-piotrowicz! - fix: Add support for D1 databases when bundling an _worker.js on wrangler pages publish#2597 416babf0 Thanks @petebacondarwin! - fix: do not crash in wrangler dev when passing a request object to fetch
This reverts and fixes the changes in https://github.com/cloudflare/workers-sdk/pull/1769 which does not support creating requests from requests whose bodies have already been consumed.
Fixes #2562
#2622 9778b33e Thanks @rozenmd! - fix: implement d1 list --json with clean output for piping into other commands
Before:
rozenmd@cflaptop test % npx wrangler d1 list
--------------------
🚧 D1 is currently in open alpha and is not recommended for production data and traffic
🚧 Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose
🚧 To request features, visit https://community.cloudflare.com/c/developers/d1
🚧 To give feedback, visit https://discord.gg/cloudflaredev
--------------------
┌──────────────────────────────┬─────────────────┐
│ uuid │ name │
├──────────────────────────────┼─────────────────┤
│ xxxxxx-xxxx-xxxx-xxxx-xxxxxx │ test │
├──────────────────────────────┼─────────────────┤
│ xxxxxx-xxxx-xxxx-xxxx-xxxxxx │ test2 │
├──────────────────────────────┼─────────────────┤
│ xxxxxx-xxxx-xxxx-xxxx-xxxxxx │ test3 │
└──────────────────────────────┴─────────────────┘
After:
rozenmd@cflaptop test % npx wrangler d1 list --json
[
{
"uuid": "xxxxxx-xxxx-xxxx-xxxx-xxxxxx",
"name": "test"
},
{
"uuid": "xxxxxx-xxxx-xxxx-xxxx-xxxxxx",
"name": "test2"
},
{
"uuid": "xxxxxx-xxxx-xxxx-xxxx-xxxxxx",
"name": "test3"
},
]
6b3fe5ef Thanks @thibmeu! - Fix wrangler publish --dry-run to not require authentication when using Queues#2627 6f0f2ba6 Thanks @rozenmd! - fix: implement d1 execute --json with clean output for piping into other commands
Before:
rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from customers"
▲ [WARNING] Processing wrangler.toml configuration:
- D1 Bindings are currently in alpha to allow the API to evolve before general availability.
Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose
Note: Run this command with the environment variable NO_D1_WARNING=true to hide this message
For example: `export NO_D1_WARNING=true && wrangler <YOUR COMMAND HERE>`
--------------------
🚧 D1 is currently in open alpha and is not recommended for production data and traffic
🚧 Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose
🚧 To request features, visit https://community.cloudflare.com/c/developers/d1
🚧 To give feedback, visit https://discord.gg/cloudflaredev
--------------------
🌀 Mapping SQL input into an array of statements
🌀 Parsing 1 statements
🌀 Executing on test (xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx):
🚣 Executed 1 command in 11.846710999961942ms
┌────────────┬─────────────────────┬───────────────────┐
│ CustomerID │ CompanyName │ ContactName │
├────────────┼─────────────────────┼───────────────────┤
│ 1 │ Alfreds Futterkiste │ Maria Anders │
├────────────┼─────────────────────┼───────────────────┤
│ 4 │ Around the Horn │ Thomas Hardy │
├────────────┼─────────────────────┼───────────────────┤
│ 11 │ Bs Beverages │ Victoria Ashworth │
├────────────┼─────────────────────┼───────────────────┤
│ 13 │ Bs Beverages │ Random Name │
└────────────┴─────────────────────┴───────────────────┘
After:
rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from customers" --json
[
{
"results": [
{
"CustomerID": 1,
"CompanyName": "Alfreds Futterkiste",
"ContactName": "Maria Anders"
},
{
"CustomerID": 4,
"CompanyName": "Around the Horn",
"ContactName": "Thomas Hardy"
},
{
"CustomerID": 11,
"CompanyName": "Bs Beverages",
"ContactName": "Victoria Ashworth"
},
{
"CustomerID": 13,
"CompanyName": "Bs Beverages",
"ContactName": "Random Name"
}
],
"success": true,
"meta": {
"duration": 1.662519000004977,
"last_row_id": null,
"changes": null,
"served_by": "primary-xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.db3",
"internal_stats": null
}
}
]
This PR makes it possible to access D1 from Durable Objects.
#2501 a0e5a491 Thanks @geelen! - fix: make it possible to query d1 databases from durable objects
This PR makes it possible to access D1 from Durable Objects.
To be able to query D1 from your Durable Object, you'll need to install the latest version of wrangler, and redeploy your Worker.
For a D1 binding like:
[[d1_databases]]
binding = "DB" # i.e. available in your Worker on env.DB
database_name = "my-database-name"
database_id = "UUID-GOES-HERE"
preview_database_id = "UUID-GOES-HERE"
You'll be able to access your D1 database via env.DB in your Durable Object.
ef110923 Thanks @penalosa! - Support queue and trace events in module middleware. This means that queue and trace events should work properly with the --test-scheduled flag#2554 fbeaf609 Thanks @CarmenPopoviciu! - feat: Add support for wasm module imports in wrangler pages dev
Currently it is not possible to import wasm modules in either Pages
Functions or Pages Advanced Mode projects.
This commit caries out work to address the aforementioned issue by
enabling wasm module imports in wrangler pages dev. As a result,
Pages users can now import their wasm modules withing their Functions
or _worker.js files, and wrangler pages dev will correctly bundle
everything and serve these "external" modules.
import hello from "./hello.wasm"
export async function onRequest() {
const module = await WebAssembly.instantiate(hello);
return new Response(module.exports.hello);
}
#2563 5ba39569 Thanks @CarmenPopoviciu! - fix: Copy module imports related files to outdir
When we bundle a Worker esbuild takes care of writing the
results to the output directory. However, if the Worker contains
any external imports, such as text/wasm/binary module imports,
that cannot be inlined into the same bundle file, bundleWorker
will not copy these files to the output directory. This doesn't
affect wrangler publish per se, because of how the Worker
upload FormData is created. It does however create some
inconsistencies when running wrangler publish --outdir or
wrangler publish --outdir --dry-run, in that, outdir will
not contain those external import files.
This commit addresses this issue by making sure the aforementioned
files do get copied over to outdir together with esbuild's
resulting bundle files.
Previously, if you provided a _worker.js file, then Pages would simply check the file for disallowed imports and then deploy the file as-is.
#2404 3f824347 Thanks @petebacondarwin! - feat: support bundling the raw Pages _worker.js before deploying
Previously, if you provided a _worker.js file, then Pages would simply check the
file for disallowed imports and then deploy the file as-is.
Not bundling the _worker.js file means that it cannot containing imports to other
JS files, but also prevents Wrangler from adding shims such as the one for the D1 alpha
release.
This change adds the ability to tell Wrangler to pass the _worker.js through the
normal Wrangler bundling process before deploying by setting the --bundle
command line argument to wrangler pages dev and wrangler pages publish.
This is in keeping with the same flag for wrangler publish.
Currently bundling is opt-in, flag defaults to false if not provided.
b44e1a75 Thanks @GregBrimble! - chore: Rename --bundle to --no-bundle in Pages commands to make similar to Workers#2551 bfffe595 Thanks @rozenmd! - fix: wrangler init --from-dash incorrectly expects index.ts while writing index.js
This PR fixes a bug where Wrangler would write a wrangler.toml expecting an index.ts file, while writing an index.js file.
#2529 2270507c Thanks @CarmenPopoviciu! - Remove "experimental _routes.json" warnings
_routes.json is no longer considered an experimental feature, so let's
remove all warnings we have in place for that.
#2548 4db768fa Thanks @rozenmd! - fix: path should be optional for wrangler d1 backup download
This PR fixes a bug that forces folks to provide a --output flag to wrangler d1 backup download.
#2528 18208091 Thanks @caass! - Add some guidance when folks encounter a 10021 error.
Error code 10021 can occur when your worker doesn't pass startup validation. This error message will make it a little easier to reason about what happened and what to do next.
Closes #2519
6a67efe9 Thanks @dario-piotrowicz! - allow fetch() calls locally to accept URL ObjectsA subtle difference when removing object-spreading of experimental unstable_dev() options caused wrangler pages dev interactivity to stop working. Thi
#2523 a5e9958c Thanks @jahands! - fix: unstable_dev() experimental options incorrectly applying defaults
A subtle difference when removing object-spreading of experimental unstable_dev() options caused wrangler pages dev interactivity to stop working. This switches back to object-spreading the passed in options on top of the defaults, fixing the issue.
When applying D1 migrations to a deployed database, it is important that we are logged in and that we have the database ID from the wrangler.toml. Thi
#2465 e1c2f5b9 Thanks @JacobMGEvans! - After this PR, wrangler init --yes will generate a test for your new Worker project, using Vitest with TypeScript.
When using wrangler init, and choosing to create a Typescript project, you will now be asked if Wrangler should write tests for you, using Vitest.
This resolves issue #2436.
71691421 Thanks @markjmiller! - Remove the experimental binding warning from Dispatch Namespace since it is GA.c2b2dfb8 Thanks @rozenmd! - fix: resolve unstable_dev flakiness in tests by awaiting the dev registry#2439 616f8739 Thanks @petebacondarwin! - fix(wrangler): do not login or read wrangler.toml when applying D1 migrations in local mode.
When applying D1 migrations to a deployed database, it is important that we are logged in
and that we have the database ID from the wrangler.toml.
This is not needed for --local mode where we are just writing to a local SQLite file.
#1869 917b07b0 Thanks @petebacondarwin! - feat: enable Wrangler to target the staging API by setting WRANGLER_API_ENVIRONMENT=staging
If you are developing Wrangler, or an internal Cloudflare feature, and during testing,
need Wrangler to target the staging API rather than production, it is now possible by
setting the WRANGLER_API_ENVIRONMENT environment variable to staging.
This will update all the necessary OAuth and API URLs, update the OAuth client ID, and also (if necessary) acquire an Access token for to get through the firewall to the staging URLs.
32686e42 Thanks @mrbbot! - Fix ReferenceError when using wrangler dev --experimental-local in Node 16#2485 4c0e2309 Thanks @GregBrimble! - fix: Pages Plugin routing when mounted at the root of a project
Previously, there was a bug which meant that Plugins mounted at the root of a Pages project were not correctly matching incoming requests. This change fixes that bug so Plugins mounted at the root should now correctly work.
#2479 7b479b91 Thanks @rozenmd! - fix: bump d1js
This PR bumps d1js, adding the following functionality to the d1 alpha shim:
7785591c Thanks @rozenmd! - fix: improve wrangler init --from-dash help text and error handling#2391 19525a4b Thanks @mrbbot! - Always log when delegating to local wrangler install.
When a global wrangler command is executed in a package directory with wrangler installed locally, the command is redirected to the local wrangler install.
We now always log a message when this happens, so you know what's going on.
97282459 Thanks @rozenmd! - BREAKING CHANGE: move experimental options under the experimental object for unstable_dev#2495 e93063e9 Thanks @petebacondarwin! - fix(d1): ensure that migrations support compound statements
This fix updates the SQL statement splitting so that it does not split in the middle of compound statements.
Previously we were using a third party splitting library, but this needed fixing and was actually unnecessary for our purposes.
So a new splitter has been implemented and the library dependency removed.
Also the error handling in d1 migrations apply has been improved to handle a wider range of error types.
Fixes #2463
08a0b22e Thanks @mrbbot! - Cleanly exit wrangler dev --experimental-local when pressing x/q/CTRL-C#2374 ecba1ede Thanks @rozenmd! - fix: make --from-dash error output clearer
This PR makes it clearer what --from-dash wants from you.
closes #2373 closes #2375
32686e42 Thanks @mrbbot! - Respect FORCE_COLOR=0 environment variable to disable colored output when using wrangler dev --local#2455 d9c1d273 Thanks @rozenmd! - BREAKING CHANGE: refactor unstable_dev to use an experimental object, instead of a second options object
Before, if you wanted to disable the experimental warning, you would run:
worker = await unstable_dev(
"src/index.js",
{},
{ disableExperimentalWarning: true }
);
After this change, you'll need to do this instead:
worker = await unstable_dev("src/index.js", {
experimental: { disableExperimentalWarning: true },
});
### Patch Changes - #2355 `df6fea02` Thanks @rozenmd! - fix: don't ask for preview_database_id in --local * #2349 `8173bcca` Thanks @jspspike! - Initi
Previously, we introduced a bug where we were incorrectly requiring @miniflare/tre, even when not using the workerd/--experimental-local mode.
#2339 f6821189 Thanks @GregBrimble! - fix: wrangler dev --local now correctly lazy-imports @miniflare/tre
Previously, we introduced a bug where we were incorrectly requiring @miniflare/tre, even when not using the workerd/--experimental-local mode.
Add @miniflare/tre environment polyfill to @cloudflare/pages-shared.
#2268 3be1c2cf Thanks @GregBrimble! - feat: Add support for --experimental-local to wrangler pages dev which will use the workerd runtime.
Add @miniflare/tre environment polyfill to @cloudflare/pages-shared.
#2163 d73a34be Thanks @jimhawkridge! - feat: Add support for Analytics Engine bindings.
For example:
analytics_engine_datasets = [
{ binding = "ANALYTICS", dataset = "my_dataset" }
]
#2177 e98613f8 Thanks @caass! - Trigger login flow if a user runs wrangler dev while logged out
Previously, we would just error if a user logged out and then ran wrangler dev.
Now, we kick them to the OAuth flow and suggest running wrangler dev --local if
the login fails.
Closes #2147
#2298 bb5e4f91 Thanks @rozenmd! - fix: d1 not using the preview database when using wrangler dev
After this fix, wrangler will correctly connect to the preview database, rather than the prod database when using wrangler dev
#2176 d48ee112 Thanks @caass! - Use the user's preferred default branch name if set in .gitconfig.
Previously, we would initialize new workers with main as the name of the default branch.
Now, we see if the user has a custom setting in .gitconfig for init.defaultBranch, and use
that if it exists.
Closes #2112
As of this change, wrangler's d1 migrations commands now accept local and persist-to as flags, so migrations can run against the local d1 db.
b24c2b2d Thanks @dalbitresb12! - feat: Allow pages dev to proxy websocket requests7da8f0e6 Thanks @Skye-31! - Fix: check response status of d1 backup download command before writing contents to file#2260 c2940160 Thanks @rozenmd! - fix: make it possible to use a local db for d1 migrations
As of this change, wrangler's d1 migrations commands now accept local and persist-to as flags, so migrations can run against the local d1 db.
60d31c01 Thanks @GregBrimble! - fix: Fix --port=0 option to report the actually used port.### Patch Changes - #2265 `42d88e3f` Thanks @WalshyDev! - Fix D1 bindings in wrangler pages dev
42d88e3f Thanks @WalshyDev! - Fix D1 bindings in wrangler pages devPrior to this change wrangler would only ever use local mode when testing d1.
e41c7e41 Thanks @mrbbot! - Enable pretty source-mapped error pages when using --experimental-local5bd04296 Thanks @OilyLime! - Add link to Queues tab in dashboard when unauthorized to use Queues### Patch Changes - #2232 `5241925a` Thanks @mrbbot! - Fix wrangler types generation for service-worker type Workers`
### Patch Changes - #2229 `8eb53b1a` Thanks @mrbbot! - Unhide --live-reload option for local mode development * #2209 `d0f237d9` Thanks @JacobMGEvans!
Publishing Pages projects containing a functions directory incorrectly did not upload the filepath-routing config so that the user can view it in Dash
#2193 0047ad30 Thanks @JacobMGEvans! - Local Mode Console Support
Added support for detailed console.log capability when using --experimental-local
resolves #2122
add4278a Thanks @mrbbot! - Add a --experimental-local-remote-kv flag to enable reading/writing from/to real KV namespaces.
Note this flag requires --experimental-local to be enabled.#2204 c725ce01 Thanks @jahands! - fix: Upload filepath-routing configuration in wrangler pages publish
Publishing Pages projects containing a functions directory incorrectly did not upload the filepath-routing config so that the user can view it in Dash. This fixes that, making the generated routes viewable under Routing configuration in the Functions tab of a deployment.
### Patch Changes - #2197 `a3533024` Thanks @geelen! - fix: truncate lines longer than 70 chars when executing d1 sql
### Patch Changes - #2194 `3dccedf1` Thanks @rozenmd! - fix: make it possible to use d1 in scheduled and queue workers
### Minor Changes - #2077 `c9b564dc` Thanks @jrf0110! - Adds tailing for Pages Functions ### Patch Changes - #2178 `d165b741` Thanks @JacobMGEvans! -
Nothing published for this version
### Patch Changes - #2182 `7d8d53a7` Thanks @geelen! - Wrangler D1 now supports the alpha release of migrations. * #2138 `2be9d642` Thanks @mrbbot! -
One column per quarter.