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
Last release 2 days ago
02 Oct 2026
Ships on a steady schedule
a new release about every 9 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
119 versions withdrawn
withdrawn after publishing
14 years old
4955 releases · first in 2012
### Patch Changes - #5238 `a0768bc` Thanks @RamIdeas! - fix: versions upload annotations (--message and/or --tag) are now applied correctly to the upl
Updated dependencies [`2e50d51`]:
2e50d51]:
One column per quarter.
For now, invocations should use the --experimental-gradual-rollouts flag.
#5224 03484c2 Thanks @RamIdeas! - feature: Implement wrangler deployments list and wrangler deployments status behind --experimental-gradual-rollouts flag.
#5115 29e8151 Thanks @RamIdeas! - feature: Implement wrangler versions deploy command.
For now, invocations should use the --experimental-gradual-rollouts flag.
Without args, a user will be guided through prompts. If args are specified, they are used as the default values for the prompts. If the --yes flag is specified, the defaults are automatically accepted for a non-interactive flow.
#5208 4730b6c Thanks @RamIdeas! - feature: Implement wrangler versions list and wrangler versions view commands behind the --experimental-gradual-rollouts flag.
#5064 bd935cf Thanks @OilyLime! - feature: Improve create and update logic for hyperdrive to include caching settings
BREAKING CHANGE (for a beta feature): wrangler d1 execute and wrangler d1 migrations commands now default --local to true. When running wrangler d1 ex…
#4930 2680462 Thanks @rozenmd! - refactor: default wrangler d1 execute and wrangler d1 migrations commands to local mode first, to match wrangler dev
This PR defaults wrangler d1 execute and wrangler d1 migrations commands to use the local development environment provided by wrangler to match the default behaviour in wrangler dev.
BREAKING CHANGE (for a beta feature): wrangler d1 execute and wrangler d1 migrations commands now default --local to true. When running wrangler d1 execute against a remote D1 database, you will need to provide the --remote flag.
#5184 046930e Thanks @nora-soderlund! - fix: change d1 migrations create to use the highest migration number rather than the first non-existing migration number to allow for gaps in the migration files.
Updated dependencies [1235d48, 27fb22b]:
Add support for Email Send, Vectorize, Hyperdrive, mTLS, Browser Rendering and Workers AI bindings in wrangler types
#5148 11951f3 Thanks @dom96! - chore: bump workerd to 1.20240304.0
#5148 11951f3 Thanks @dom96! - fix: use python_workers compat flag for Python
#5089 5b85dc9 Thanks @DaniFoldi! - fix: include all currently existing bindings in wrangler types
Add support for Email Send, Vectorize, Hyperdrive, mTLS, Browser Rendering and Workers AI bindings in wrangler types
For example, from the following wrangler.toml setup:
[browser]
binding = "BROWSER"
[ai]
binding = "AI"
[[send_email]]
name = "SEND_EMAIL"
[[vectorize]]
binding = "VECTORIZE"
index_name = "VECTORIZE_NAME"
[[hyperdrive]]
binding = "HYPERDRIVE"
id = "HYPERDRIVE_ID"
[[mtls_certificates]]
binding = "MTLS"
certificate_id = "MTLS_CERTIFICATE_ID"
Previously, nothing would have been included in the generated Environment. Now, the following will be generated:
interface Env {
SEND_EMAIL: SendEmail;
VECTORIZE: VectorizeIndex;
HYPERDRIVE: Hyperdrive;
MTLS: Fetcher;
BROWSER: Fetcher;
AI: Fetcher;
}
Updated dependencies [11951f3, 11951f3]:
When running unstable_dev() in its default "test mode", the logging level was set to none. This meant any Worker startup errors or helpful warnings wo
#5119 b0bd413 Thanks @garrettgu10! - feature: Python support for remote dev
#5118 30694a3 Thanks @garrettgu10! - fix: Including version identifiers in Python requirements.txt will now throw an error
#5132 82a3f94 Thanks @mrbbot! - fix: switch default logging level of unstable_dev() to warn
When running unstable_dev() in its default "test mode", the logging level was set to none. This meant any Worker startup errors or helpful warnings wouldn't be shown. This change switches the default to warn. To restore the previous behaviour, include logLevel: "none" in your options object:
const worker = await unstable_dev("path/to/script.js", {
logLevel: "none",
});
#5128 d27e2a7 Thanks @taylorlee! - fix: Add legacy_env support to experimental versions upload command.
#5087 a5231de Thanks @dario-piotrowicz! - fix: make wrangler types always generate a d.ts file for module workers
Currently if a config file doesn't define any binding nor module, running
wrangler types against such file would not produce a d.ts file.
Producing a d.ts file can however still be beneficial as it would define a correct
env interface (even if empty) that can be expanded/referenced by user code (this can
be particularly convenient for scaffolding tools that may want to always generate an
env interface).
Example:
Before wrangler types --env-interface MyEnv run with an empty wrangler.toml file
would not generate any file, after these change it would instead generate a file with
the following content:
interface MyEnv {
}
#5138 3dd9089 Thanks @G4brym! - fix: ensure Workers-AI local mode fetcher returns headers to client worker
Updated dependencies [42bcc72, 42bcc72]:
Previously, requests sent to wrangler dev with unconsumed bodies could result in Network connection lost errors. This change attempts to work around t
#5106 2ed7f32 Thanks @RamIdeas! - fix: automatically drain incoming request bodies
Previously, requests sent to wrangler dev with unconsumed bodies could result in Network connection lost errors. This change attempts to work around the issue by ensuring incoming request bodies are drained if they're not used. This is a temporary fix whilst we try to address the underlying issue. Whilst we don't think this change will introduce any other issues, it can be disabled by setting the WRANGLER_DISABLE_REQUEST_BODY_DRAINING=true environment variable. Note this fix is only applied if you've enabled Wrangler's bundling—--no-bundle mode continues to have the previous behaviour.
#5107 65d0399 Thanks @penalosa! - fix: Ensures that switching to remote mode during a dev session (from local mode) will correctly use the right zone. Previously, zone detection happened before the dev session was mounted, and so dev sessions started with local mode would have no zone inferred, and would have failed to start, with an ugly error.
#5107 65d0399 Thanks @penalosa! - fix: Ensure that preview sessions created without a zone don't switch the host on which to start the preview from the one returned by the API.
#4833 54f6bfc Thanks @admah! - fix: remove extra arguments from wrangler init deprecation message and update recommended c3 version
c3 can now infer the pre-existing type from the presence of the --existing-script flag so we can remove the extra type argument. C3 2.5.0 introduces an auto-update feature that will make sure users get the latest minor version of c3 and prevent problems where older 2.x.x versions get cached by previous runs of wrangler init.
The developer is now able to specify the `preserve_file_names property in wrangler.toml which specifies whether Wrangler will preserve the file names
#4742 c2f3f1e Thanks @benycodes! - feat: allow preserving file names when defining rules for non-js modules
The developer is now able to specify the `preserve_file_names property in wrangler.toml which specifies whether Wrangler will preserve the file names additional modules that are added to the deployment bundle of a Worker.
If not set to true, files will be named using the pattern ${fileHash}-${basename}.
For example, 34de60b44167af5c5a709e62a4e20c4f18c9e3b6-favicon.ico.
Resolves #4741
0c0949d]:
Allow users to specify the name of the interface that they want wrangler types to generate for the env parameter, via the new CLI flag --env-interface
#5042 5693d076 Thanks @dario-piotrowicz! - feat: add new --env-interface to wrangler types
Allow users to specify the name of the interface that they want wrangler types to generate for the env parameter, via the new CLI flag --env-interface
Example:
wrangler types --env-interface CloudflareEnv
generates
interface CloudflareEnv {}
instead of
interface Env {}
#5042 5693d076 Thanks @dario-piotrowicz! - feat: add new path positional argument to wrangler types
Allow users to specify the path to the typings (.d.ts) file they want
wrangler types to generate
Example:
wrangler types ./my-env.d.ts
generates a my-env.d.ts file in the current directory
instead of creating a worker-configuration.d.ts file
#5042 5693d076 Thanks @dario-piotrowicz! - feat: include command run in the wrangler types comment
In the comment added to the .d.ts file generated by wrangler types
include the command run to generated the file
1c460287 Thanks @richardscarrott! - fix: allow Pages Functions to import built-in node:* modules, even when not bundling with wrangler50f93bd2 Thanks @garrettgu10! - fix: don't strip .py extensions from Python modules#5042 5693d076 Thanks @dario-piotrowicz! - fix: make wrangler types honor top level config argument
The wrangler types command currently ignores the -c|--config argument
(although it is still getting shown in the command's help message). Make
sure that the command honors the flag.
Also, if no config file is detected
present a warning to the user
#5042 5693d076 Thanks @dario-piotrowicz! - fix: make the wrangler types command pick up local secret keys from .dev.vars
Make sure that the wrangler types command correctly picks up
secret keys defined in .dev.vars and includes them in the generated
file (marking them as generic string types of course)
Updated dependencies [b03db864]:
This command tries to use the namespace name as the binding. Previously, we would unnecessarily error if this namespace name did not fit the binding n
#5050 88be4b84 Thanks @nora-soderlund! - fix: allow kv:namespace create to accept a namespace name that contains characters not allowed in a binding name
This command tries to use the namespace name as the binding. Previously, we would unnecessarily error if this namespace name did not fit the binding name constraints. Now we accept such names and then remove invalid characters when generating the binding name.
make sure that the caches object returned to getPlatformProxy behaves in the same manner as the one present in production (where calling unsupported m
#5026 04584722 Thanks @dario-piotrowicz! - fix: make sure getPlatformProxy produces a production-like caches object
make sure that the caches object returned to getPlatformProxy behaves
in the same manner as the one present in production (where calling unsupported
methods throws a helpful error message)
note: make sure that the unsupported methods are however not included in the
CacheStorage type definition
#5030 55ea0721 Thanks @mrbbot! - fix: don't suggest reporting user errors to GitHub
Wrangler has two different types of errors: internal errors caused by something going wrong, and user errors caused by an invalid configuration. Previously, we would encourage users to submit bug reports for user errors, even though there's nothing we can do to fix them. This change ensures we only suggest this for internal errors.
#4900 3389f2e9 Thanks @OilyLime! - feature: allow hyperdrive users to set local connection string as environment variable
Wrangler dev now supports the HYPERDRIVE_LOCAL_CONNECTION_STRING environmental variable for connecting to a local database instance when testing Hyperdrive in local development. This environmental variable takes precedence over the localConnectionString set in wrangler.toml.
#5033 b1ace91b Thanks @mrbbot! - fix: wait for actual port before opening browser with --port=0
Previously, running wrangler dev --remote --port=0 and then immediately pressing b would open localhost:0 in your default browser. This change queues up opening the browser until Wrangler knows the port the dev server was started on.
#5026 04584722 Thanks @dario-piotrowicz! - fix: relax the getPlatformProxy's' cache request/response types
prior to these changes the caches obtained from getPlatformProxy
would use unknowns as their types, this proved too restrictive
and incompatible with the equivalent @cloudflare/workers-types
types, we decided to use anys instead to allow for more flexibility
whilst also making the type compatible with workers-types
Updated dependencies [7723ac17, 027f9719, 027f9719, 027f9719, 027f9719, 027f9719, 027f9719]:
#4475 86d94ff Thanks @paulrostorp! - feat: support custom HTTPS certificate paths in Wrangler dev commands.
Adds flags --https-key-path and --https-cert-path to wrangler dev and wrangler pages dev commands.
Fixes #2118
_note_: getBindingProxy with its signature is still kept available, making this a non breaking change
#4950 05360e43 Thanks @petebacondarwin! - fix: ensure we do not rewrite external Origin headers in wrangler dev
In https://github.com/cloudflare/workers-sdk/pull/4812 we tried to fix the Origin headers to match the Host header but were overzealous and rewrote Origin headers for external origins (outside of the proxy server's origin).
This is now fixed, and moreover we rewrite any headers that refer to the proxy server on the request with the configured host and vice versa on the response.
This should ensure that CORS is not broken in browsers when a different host is being simulated based on routes in the Wrangler configuration.
bfeefe27 Thanks @dario-piotrowicz! - chore: add missing defineNavigatorUserAgent dependency to useEsbuild hook#5002 315a651b Thanks @dario-piotrowicz! - chore: rename getBindingsProxy to getPlatformProxy
initially getBindingsProxy was supposed to only provide proxies for bindings,
the utility has however grown, including now cf, ctx and caches, to
clarify the increased scope the utility is getting renamed to getPlatformProxy
and its bindings field is getting renamed env
note: getBindingProxy with its signature is still kept available, making this
a non breaking change
Updated dependencies [05360e43]:
The previous Wrangler release introduced a regression that caused reloads to fail when importing node:* modules. This change fixes that, and ensures t
#4962 d6585178 Thanks @mrbbot! - fix: ensure wrangler dev can reload without crashing when importing node:* modules
The previous Wrangler release introduced a regression that caused reloads to fail when importing node:* modules. This change fixes that, and ensures these modules can always be resolved.
ffafe8ad Thanks @nora-soderlund! - fix: D1 batch splitting to handle CASE as compound statement startsPreviously, Wrangler treated any imports of node:* modules as build-time errors (unless one of the two Node.js compatibility modes was enabled). This
#4499 cf9c029b Thanks @penalosa! - feat: Support runtime-agnostic polyfills
Previously, Wrangler treated any imports of node:* modules as build-time errors (unless one of the two Node.js compatibility modes was enabled). This is sometimes overly aggressive, since those imports are often not hit at runtime (for instance, it was impossible to write a library that worked across Node.JS and Workers, using Node packages only when running in Node). Here's an example of a function that would cause Wrangler to fail to build:
export function randomBytes(length: number) {
if (navigator.userAgent !== "Cloudflare-Workers") {
return new Uint8Array(require("node:crypto").randomBytes(length));
} else {
return crypto.getRandomValues(new Uint8Array(length));
}
}
This function should work in both Workers and Node, since it gates Node-specific functionality behind a user agent check, and falls back to the built-in Workers crypto API. Instead, Wrangler detected the node:crypto import and failed with the following error:
✘ [ERROR] Could not resolve "node:crypto"
src/randomBytes.ts:5:36:
5 │ ... return new Uint8Array(require('node:crypto').randomBytes(length));
╵ ~~~~~~~~~~~~~
The package "node:crypto" wasn't found on the file system but is built into node.
Add "node_compat = true" to your wrangler.toml file to enable Node.js compatibility.
This change turns that Wrangler build failure into a warning, which users can choose to ignore if they know the import of node:* APIs is safe (because it will never trigger at runtime, for instance):
▲ [WARNING] The package "node:crypto" wasn't found on the file system but is built into node.
Your Worker may throw errors at runtime unless you enable the "nodejs_compat"
compatibility flag. Refer to
https://developers.cloudflare.com/workers/runtime-apis/nodejs/ for more details.
Imported from:
- src/randomBytes.ts
However, in a lot of cases, it's possible to know at build time whether the import is safe. This change also injects navigator.userAgent into esbuild's bundle settings as a predefined constant, which means that esbuild can tree-shake away imports of node:* APIs that are guaranteed not to be hit at runtime, supressing the warning entirely.
#4926 a14bd1d9 Thanks @dario-piotrowicz! - feature: add a cf field to the getBindingsProxy result
Add a new cf field to the getBindingsProxy result that people can use to mock the production
cf (IncomingRequestCfProperties) object.
Example:
const { cf } = await getBindingsProxy();
console.log(`country = ${cf.country}; colo = ${cf.colo}`);
#4931 321c7ed7 Thanks @dario-piotrowicz! - fix: make the entrypoint optional for the types command
Currently running wrangler types against a wrangler.toml file without a defined entrypoint (main value)
causes the command to error with the following message:
✘ [ERROR] Missing entry-point: The entry-point should be specified via the command line (e.g. `wrangler types path/to/script`) or the `main` config field.
However developers could want to generate types without the entrypoint being defined (for example when using getBindingsProxy), so these changes
make the entrypoint optional for the types command, assuming modules syntax if none is specified.
#4867 d637bd59 Thanks @RamIdeas! - fix: inflight requests to UserWorker which failed across reloads are now retried
Previously, when running wrangler dev, requests inflight during a UserWorker reload (due to config or source file changes) would fail.
Now, if those inflight requests are GET or HEAD requests, they will be reproxied against the new UserWorker. This adds to the guarantee that requests made during local development reach the latest worker.
#4938 75bd08ae Thanks @rozenmd! - fix: print wrangler banner at the start of every d1 command
This PR adds a wrangler banner to the start of every D1 command (except when invoked in JSON-mode)
For example:
⛅️ wrangler 3.27.0
-------------------
...
#4953 d96bc7dd Thanks @mrbbot! - fix: allow port option to be specified with unstable_dev()
Previously, specifying a non-zero port when using unstable_dev() would try to start two servers on that port. This change ensures we only start the user-facing server on the specified port, allow unstable_dev() to startup correctly.
When Pages is used in conjunction with a full stack framework, the framework build will temporarily remove files that are being watched by Pages, such
#4877 3e7cd6e4 Thanks @magnusdahlstrand! - fix: Do not show unnecessary errors during watch rebuilds
When Pages is used in conjunction with a full stack framework, the framework
build will temporarily remove files that are being watched by Pages, such as
_worker.js and _routes.json.
Previously we would display errors for these changes, which adds confusing and excessive messages to the Pages dev output. Now builds are skipped if a watched _worker.js or _routes.json is removed.
#4901 2469e9fa Thanks @penalosa! - feature: implemented Python support in Wrangler
Python Workers are now supported by wrangler deploy and wrangler dev.
#4922 4c7031a6 Thanks @dario-piotrowicz! - feature: add a ctx field to the getBindingsProxy result
Add a new ctx filed to the getBindingsProxy result that people can use to mock the production
ExecutionContext object.
Example:
const { ctx } = await getBindingsProxy();
ctx.waitUntil(myPromise);
e61dba50 Thanks @nora-soderlund! - fix: ensure d1 validation errors render user friendly messages#4907 583e4451 Thanks @mrbbot! - fix: mark R2 object and bucket not found errors as unreportable
Previously, running wrangler r2 objects {get,put} with an object or bucket that didn't exist would ask if you wanted to report that error to Cloudflare. There's nothing we can do to fix this, so this change prevents the prompt in this case.
#4872 5ef56067 Thanks @rozenmd! - fix: intercept and stringify errors thrown by d1 execute in --json mode
Prior to this PR, if a query threw an error when run in wrangler d1 execute ... --json, wrangler would swallow the error.
This PR returns the error as JSON. For example, the invalid query SELECT asdf; now returns the following in JSON mode:
{
"error": {
"text": "A request to the Cloudflare API (/accounts/xxxx/d1/database/xxxxxxx/query) failed.",
"notes": [
{
"text": "no such column: asdf at offset 7 [code: 7500]"
}
],
"kind": "error",
"name": "APIError",
"code": 7500
}
}
#4888 3679bc18 Thanks @petebacondarwin! - fix: ensure that the Pages dev proxy server does not change the Host header
Previously, when configuring wrangler pages dev to use a proxy to a 3rd party dev server,
the proxy would replace the Host header, resulting in problems at the dev server if it was
checking for cross-site scripting attacks.
Now the proxy server passes through the Host header unaltered making it invisible to the 3rd party dev server.
Fixes #4799
#4909 34b6ea1e Thanks @rozenmd! - feat: add an experimental insights command to wrangler d1
This PR adds a wrangler d1 insights <DB_NAME> command, to let D1 users figure out which of their queries to D1 need to be optimised.
This command defaults to fetching the top 5 queries that took the longest to run in total over the last 24 hours.
You can also fetch the top 5 queries that consumed the most rows read over the last week, for example:
npx wrangler d1 insights northwind --sortBy reads --timePeriod 7d
Or the top 5 queries that consumed the most rows written over the last month, for example:
npx wrangler d1 insights northwind --sortBy writes --timePeriod 31d
Or the top 5 most frequently run queries in the last 24 hours, for example:
npx wrangler d1 insights northwind --sortBy count
#4830 48f90859 Thanks @Lekensteyn! - fix: listen on loopback for wrangler dev port check and login
Avoid listening on the wildcard address by default to reduce the attacker's surface and avoid firewall prompts on macOS.
Relates to #4430.
#4907 583e4451 Thanks @mrbbot! - fix: ensure wrangler dev --log-level flag applied to all logs
Previously, wrangler dev may have ignored the --log-level flag for some startup logs. This change ensures the --log-level flag is applied immediately.
Updated dependencies [148feff6]:
Add a new caches field to the getBindingsProxy result, such field implements a no operation (no-op) implementation of the runtime caches
#4847 6968e11f Thanks @dario-piotrowicz! - feature: expose new (no-op) caches field in getBindingsProxy result
Add a new caches field to the getBindingsProxy result, such field implements a
no operation (no-op) implementation of the runtime caches
Note: Miniflare exposes a proper caches mock, we will want to use that one in
the future but issues regarding it must be ironed out first, so for the
time being a no-op will have to do
#4860 b92e5ac0 Thanks @Sibirius! - fix: allow empty strings in secret:bulk upload
Previously, the secret:bulk command would fail if any of the secrets in the secret.json file were empty strings and they already existed remotely.
#4869 fd084bc0 Thanks @jculvey! - feature: Expose AI bindings to getBindingsProxy.
The getBindingsProxy utility function will now contain entries for any AI bindings specified in wrangler.toml.
#4880 65da40a1 Thanks @petebacondarwin! - fix: do not attempt login during dry-run
The "standard pricing" warning was attempting to make an API call that was causing a login attempt even when on a dry-run. Now this warning is disabled during dry-runs.
Fixes #4723
#4819 6a4cb8c6 Thanks @magnusdahlstrand! - fix: Use appropriate logging levels when parsing headers and redirects in wrangler pages dev.
Updated dependencies [1e424ff2, 749fa3c0]:
…to set the configuration. Note that this is a breaking change from the previous behaviour where you could configure AWS as the provider without explic…
#4815 030360d6 Thanks @jonesphillip! - feature: adds support for configuring Sippy with Google Cloud Storage (GCS) provider.
Sippy (https://developers.cloudflare.com/r2/data-migration/sippy/) now supports Google Cloud Storage.
This change updates the wrangler r2 sippy commands to take a provider (AWS or GCS) and appropriate configuration arguments.
If you don't specify --provider argument then the command will enter an interactive flow for the user to set the configuration.
Note that this is a breaking change from the previous behaviour where you could configure AWS as the provider without explictly specifying the --provider argument.
(This breaking change is allowed in a minor release because the Sippy feature and wrangler r2 sippy commands are marked as beta.)
#4841 10396125 Thanks @rozenmd! - fix: replace D1's dashed time-travel endpoints with underscored ones
D1 will maintain its d1/database/${databaseId}/time-travel/* endpoints until GA, at which point older versions of wrangler will start throwing errors to users, asking them to upgrade their wrangler version to continue using Time Travel via CLI.
#4656 77b0bce3 Thanks @petebacondarwin! - fix: ensure upstream_protocol is passed to the Worker
In wrangler dev it is possible to set the upstream_protocol,
which is the protocol under which the User Worker believes it has been
requested, as recorded in the request.url that can be used for
forwarding on requests to the origin.
Previously, it was not being passed to wrangler dev in local mode.
Instead it was always set to http.
Note that setting upstream_protocol to http is not supported in
wrangler dev remote mode, which is the case since Wrangler v2.0.
This setting now defaults to https in remote mode (since that is the only option),
and to the same as local_protocol in local mode.
Fixes #4539
#4810 6eb2b9d1 Thanks @gabivlj! - fix: Cloudchamber command shows json error message on load account if --json specified
If the user specifies a json option, we should see a more detailed error on why loadAccount failed.
#4820 b01c1548 Thanks @mrbbot! - fix: show up-to-date sources in DevTools when saving source files
Previously, DevTools would never refresh source contents after opening a file, even if it was updated on-disk. This could cause issues with step-through debugging as breakpoints set in source files would map to incorrect locations in bundled Worker code. This change ensures DevTools' source cache is cleared on each reload, preventing outdated sources from being displayed.
Updated dependencies [8166eefc]:
The new utility is part of wrangler's JS API (it is not part of the wrangler CLI) and its use is to provide proxy objects to bindings, such objects ca
#4523 9f96f28b Thanks @dario-piotrowicz! - Add new getBindingsProxy utility to the wrangler package
The new utility is part of wrangler's JS API (it is not part of the wrangler CLI) and its use is to provide proxy objects to bindings, such objects can be used in Node.js code as if they were actual bindings
The utility reads the wrangler.toml file present in the current working directory in order to discern what bindings should be available (a wrangler.json file can be used too, as well as config files with custom paths).
Assuming that in the current working directory there is a wrangler.toml file with the following
content:
[[kv_namespaces]]
binding = "MY_KV"
id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
The utility could be used in a nodejs script in the following way:
import { getBindingsProxy } from "wrangler";
const { bindings, dispose } = await getBindingsProxy();
try {
const myKv = bindings.MY_KV;
const kvValue = await myKv.get("my-kv-key");
console.log(`KV Value = ${kvValue}`);
} finally {
await dispose();
}
#3427 b79e93a3 Thanks @ZakKemble! - fix: Use Windows SYSTEMROOT env var for finding netstat
Currently, the drive letter of os.homedir() (the user's home directory) is used to build the path to netstat.exe. However, user directories are not always on the same drive as the Windows installation, in which case the path to netstat will be incorrect. Now we use the %SYSTEMROOT% environment variable which correctly points to the installation path of Windows.
#4768 c3e410c2 Thanks @petebacondarwin! - ci: bump undici versions to 5.28.2
Updated dependencies [c3e410c2]:
Only specifying the name and type of a binding instructs the patch API to copy the existing binding over - but we were including the contents of the b
#4674 54ea6a53 Thanks @matthewdavidrodgers! - Fix usage of patch API in bulk secrets update
Only specifying the name and type of a binding instructs the patch API to copy the existing binding over - but we were including the contents of the binding as well. Normally that's OK, but there are some subtle differences between what you specify to create a binding vs what it looks like once it's created, specifically for Durable Objects. So instead, we just use the simpler inheritance.
#4772 4a9f03cf Thanks @mrbbot! - fix: ensure dev server doesn't change request URLs
Previously, Wrangler's dev server could change incoming request URLs unexpectedly (e.g. rewriting http://localhost:8787//test to http://localhost:8787/test). This change ensures URLs are passed through without modification.
Fixes #4743.
Previously, Wrangler would offer to report any error to Cloudflare. This included errors caused by misconfigurations or invalid commands. This change
#4707 96a27f3d Thanks @mrbbot! - fix: only offer to report unknown errors
Previously, Wrangler would offer to report any error to Cloudflare. This included errors caused by misconfigurations or invalid commands. This change ensures those types of errors aren't reported.
078cf84d Thanks @dario-piotrowicz! - make sure the script path is correctly resolved in pages dev when no directory is specified#4722 5af6df13 Thanks @mrbbot! - fix: don't require auth for wrangler r2 object --local operations
Previously, Wrangler would ask you to login when reading or writing from local R2 buckets. This change ensures no login prompt is displayed, as authentication isn't required for these operations.
#4719 c37d94b5 Thanks @mrbbot! - fix: ensure miniflare and wrangler can source map in the same process
Previously, if in a wrangler dev session you called console.log() and threw an unhandled error you'd see an error like [ERR_ASSERTION]: The expression evaluated to a falsy value. This change ensures you can do both of these things in the same session.
#4683 24147166 Thanks @mrbbot! - fix: ensure logs containing at not truncated to at [object Object]
Previously, logs containing at were always treated as stack trace call sites requiring source mapping. This change updates the call site detection to avoid false positives.
#4748 3603a60d Thanks @Cherry! - fix: resolve imports in a more node-like fashion for packages that do not declare exports
Previously, trying to import a file that wasn't explicitly exported from a module would result in an error, but now, better attempts are made to resolve the import using node's module resolution algorithm. It's now possible to do things like this:
import JPEG_DEC_WASM from "@jsquash/jpeg/codec/dec/mozjpeg_dec.wasm";
This works even if the mozjpeg_dec.wasm file isn't explicitly exported from the @jsquash/jpeg module.
Fixes #4726
#4687 0a488f66 Thanks @mrbbot! - fix: remove confusing --local messaging from wrangler pages dev
Running wrangler pages dev would previously log a warning saying --local is no longer required even though --local was never set. This change removes this warning.
Updated dependencies [4f6999ea, c37d94b5]:
wrangler@3.19.0 introduced a bug where starting multiple wrangler dev sessions with service bindings to each other resulted in a reload loop. This cha
#4699 4b4c1416 Thanks @mrbbot! - fix: prevent repeated reloads with circular service bindings
wrangler@3.19.0 introduced a bug where starting multiple wrangler dev sessions with service bindings to each other resulted in a reload loop. This change ensures Wrangler only reloads when dependent wrangler dev sessions start/stop.
Previously, wrangler dev would exit with a non-zero exit code when pressing CTRL + C or x . This change ensures wrangler exits with code 0 in these ca
#4693 93e88c43 Thanks @mrbbot! - fix: ensure wrangler dev exits with code 0 on clean exit
Previously, wrangler dev would exit with a non-zero exit code when pressing <kbd>CTRL</kbd>+<kbd>C</kbd> or <kbd>x</kbd>. This change ensures wrangler exits with code 0 in these cases.
#4630 037de5ec Thanks @petebacondarwin! - fix: ensure User Worker gets the correct Host header in wrangler dev local mode
Some full-stack frameworks, such as Next.js, check that the Host header for a server side action request matches the host where the application is expected to run.
In wrangler dev we have a Proxy Worker in between the browser and the actual User Worker.
This Proxy Worker is forwarding on the request from the browser, but then the actual User
Worker is running on a different host:port combination than that which the browser thinks
it should be on. This was causing the framework to think the request is malicious and blocking
it.
Now we update the request's Host header to that passed from the Proxy Worker in a custom MF-Original-Url
header, but only do this if the request also contains a shared secret between the Proxy Worker
and User Worker, which is passed via the MF-Proxy-Shared-Secret header. This last feature is to
prevent a malicious website from faking the Host header in a request directly to the User Worker.
Fixes https://github.com/cloudflare/next-on-pages/issues/588
0f8a03c0 Thanks @mrbbot! - fix: ensure API failures without additional messages logged correctly#4693 93e88c43 Thanks @mrbbot! - fix: ensure wrangler pages dev exits cleanly
Previously, pressing <kbd>CTRL</kbd>+<kbd>C</kbd> or <kbd>x</kbd> when running wrangler pages dev wouldn't actually exit wrangler. You'd need to press <kbd>CTRL</kbd>+<kbd>C</kbd> a second time to exit the process. This change ensures wrangler exits the first time.
#4696 624084c4 Thanks @mrbbot! - fix: include additional modules in largest dependencies warning
If your Worker fails to deploy because it's too large, Wrangler will display of list of your Worker's largest dependencies. Previously, this just included JavaScript dependencies. This change ensures additional module dependencies (e.g. WebAssembly, text blobs, etc.) are included when computing this list.
Updated dependencies [037de5ec]:
Previously if a Worker failed validation during wrangler deploy, the displayed error would reference locations in built JavaScript files. This made it
#4600 4233e514 Thanks @mrbbot! - fix: apply source mapping to deployment validation errors
Previously if a Worker failed validation during wrangler deploy, the displayed error would reference locations in built JavaScript files. This made it more difficult to debug validation errors. This change ensures these errors are now source mapped, referencing locations in source files instead.
#4440 15717333 Thanks @mrbbot! - fix: automatically create required directories for wrangler r2 object get
Previously, if you tried to use wrangler r2 object get with an object name containing a / or used the --file flag with a path containing a /, and the specified directory didn't exist, Wrangler would throw an ENOENT error. This change ensures Wrangler automatically creates required parent directories if they don't exist.
#4592 20da658e Thanks @mrbbot! - fix: throw helpful error if email validation required
Previously, Wrangler would display the raw API error message and code if email validation was required during wrangler deploy. This change ensures a helpful error message is displayed instead, prompting users to check their emails or visit the dashboard for a verification link.
e1d50407 Thanks @mrbbot! - fix: suggest checking permissions on authentication error with API token set#4588 4e5ed0b2 Thanks @mrbbot! - fix: require worker name for rollback
Previously, Wrangler would fail with a cryptic error if you tried to run wrangler rollback outside of a directory containing a Wrangler configuration file with a name defined. This change validates that a worker name is defined, and allows you to set it from the command line using the --name flag.
Updated dependencies [c410ea14]:
Previously, running wrangler dev would leave behind "zombie" workerd processes. These processes prevented the same port being bound if wrangler dev wa
#4635 5bc2699d Thanks @mrbbot! - fix: prevent zombie workerd processes
Previously, running wrangler dev would leave behind "zombie" workerd processes. These processes prevented the same port being bound if wrangler dev was restarted and sometimes consumed lots of CPU time. This change ensures all workerd processes are killed when wrangler dev is shutdown.
To clean-up existing zombie processes, run pkill -KILL workerd on macOS/Linux or taskkill /f /im workerd.exe on Windows.
### Minor Changes - #4632 `a6a4e8a4` Thanks @G4brym! - Deprecate constellation commands and add a warning when using the constellation binding * #4130
Previously, Wrangler would only apply source mapping to uncaught exceptions. This meant if you caught an exception and logged its stack trace, the cal
#4423 a94ef570 Thanks @mrbbot! - feat: apply source mapping to logged strings
Previously, Wrangler would only apply source mapping to uncaught exceptions. This meant if you caught an exception and logged its stack trace, the call sites would reference built JavaScript files as opposed to source files. This change looks for stack traces in logged messages, and tries to source map them.
Note source mapping is only applied when outputting logs. Error#stack does not return a source mapped stack trace. This means the actual runtime value of new Error().stack and the output from console.log(new Error().stack) may be different.
When Wrangler's top-level exception handler catches an error thrown from Wrangler's application, it will offer to report the error to Sentry. This req
#4571 3314dbde Thanks @penalosa! - feat: When Wrangler crashes, send an error report to Sentry to aid in debugging.
When Wrangler's top-level exception handler catches an error thrown from Wrangler's application, it will offer to report the error to Sentry. This requires opt-in from the user every time.
4c85fe99 Thanks @dario-piotrowicz! - During the R2 validation, show MAX_UPLOAD_SIZE errors using MiB (consistently with the Cloudflare docs)#4577 4c85fe99 Thanks @dario-piotrowicz! - During the Pages validation, show MAX_UPLOAD_SIZE errors using MiB (consistently with the Cloudflare docs)
Updated dependencies [eb08e2dc]:
Due to a known issue, workerd will only listen on the IPv4 loopback address 127.0.0.1 when it's asked to listen on localhost. On Node.js > 17, localho
#4547 86c81ff0 Thanks @mrbbot! - fix: listen on IPv4 loopback only by default on Windows
Due to a known issue, workerd will only listen on the IPv4 loopback address 127.0.0.1 when it's asked to listen on localhost. On Node.js > 17, localhost will resolve to the IPv6 loopback address, meaning requests to workerd would fail. This change switches to using the IPv4 loopback address throughout Wrangler on Windows, while workerd#1408 gets fixed.
#4535 29df8e17 Thanks @mrbbot! - Reintroduces some internal refactorings of wrangler dev servers (including wrangler dev, wrangler dev --remote, and unstable_dev()).
These changes were released in 3.13.0 and reverted in 3.13.1 -- we believe the changes are now more stable and ready for release again.
There are no changes required for developers to opt-in. Improvements include:
6c5bc704 Thanks @zebp! - fix: init from dash specifying explicit usage model in wrangler.toml for standard users#4550 63708a94 Thanks @mrbbot! - fix: validate Host and Orgin headers where appropriate
Host and Origin headers are now checked when connecting to the inspector and Miniflare's magic proxy. If these don't match what's expected, the request will fail.
Updated dependencies [71fb0b86, 63708a94]:
This change switches wrangler (pages) dev to just listen on local interfaces. Whilst this is technically a breaking change, we've decided the security…
#4532 311ffbd5 Thanks @mrbbot! - fix: change wrangler (pages) dev to listen on localhost by default
Previously, Wrangler listened on all interfaces (*) by default. This change switches wrangler (pages) dev to just listen on local interfaces. Whilst this is technically a breaking change, we've decided the security benefits outweigh the potential disruption caused. If you need to access your dev server from another device on your network, you can use wrangler (pages) dev --ip * to restore the previous behaviour.
1b348782]:
This change ensures Wrangler doesn't try to open http://* when * is used as the dev server's hostname. Instead, Wrangler will now open http://127.0.0.
#4474 382ef8f5 Thanks @mrbbot! - fix: open browser to correct url pressing b in --remote mode
This change ensures Wrangler doesn't try to open http://* when * is used as the dev server's hostname. Instead, Wrangler will now open http://127.0.0.1.
#4488 3bd57238 Thanks @RamIdeas! - Changes the default directory for log files to workaround frameworks that are watching the entire .wrangler directory in the project root for changes
Also includes a fix for commands with --json where the log file location message would cause stdout to not be valid JSON. That message now goes to stderr.
Wrangler now filters workerd stdout/stderr and marks unactionable messages as debug logs. These debug logs are still observable in the debug log file
#4341 d9908743 Thanks @RamIdeas! - Wrangler now writes all logs to a .log file in the .wrangler directory. Set a directory or specific .log filepath to write logs to with WRANGLER_LOG_PATH=../Desktop/my-logs/ or WRANGLER_LOG_PATH=../Desktop/my-logs/my-log-file.log. When specifying a directory or using the default location, a filename with a timestamp is used.
Wrangler now filters workerd stdout/stderr and marks unactionable messages as debug logs. These debug logs are still observable in the debug log file but will no longer show in the terminal by default without the user setting the env var WRANGLER_LOG=debug.
d5e1966b Thanks @mrbbot! - fix: report correct line and column numbers when source mapping errors with wrangler dev --remote805d5241 Thanks @dario-piotrowicz! - add warnings about ai and verctorize bindings not being supported locally…failing for others. In order to not introduce breaking changes for logging output, the language around "${x} secrets were updated" or "${x} secrets fa…
102e15f9 Thanks @Skye-31! - Feat(unstable_dev): Provide an option for unstable_dev to perform the check that prompts users to update wrangler, defaulting to false. This will prevent unstable_dev from sending a request to NPM on startup to determine whether it needs to be updated.#4179 dd270d00 Thanks @matthewdavidrodgers! - Simplify secret:bulk api via script settings
Firing PUTs to the secret api in parallel has never been a great solution - each request independently needs to lock the script, so running in parallel is at best just as bad as running serially.
Luckily, we have the script settings PATCH api now, which can update the settings for a script (including secret bindings) at once, which means we don't need any parallelization. However this api doesn't work with a partial list of bindings, so we have to fetch the current bindings and merge in with the new secrets before PATCHing. We can however just omit the value of the binding (i.e. only provide the name and type) which instructs the config service to inherit the existing value, which simplifies this as well. Note that we don't use the bindings in your current wrangler.toml, as you could be in a draft state, and it makes sense as a user that a bulk secrets update won't update anything else. Instead, we use script settings api again to fetch the current state of your bindings.
This simplified implementation means the operation can only fail or succeed, rather than succeeding in updating some secrets but failing for others. In order to not introduce breaking changes for logging output, the language around "${x} secrets were updated" or "${x} secrets failed" is kept, even if it doesn't make much sense anymore.
#4402 baa76e77 Thanks @rozenmd! - This PR adds a fetch handler that uses page, assuming result_info provided by the endpoint contains page, per_page, and total
This is needed as the existing fetchListResult handler for fetching potentially paginated results doesn't work for endpoints that don't implement cursor.
Fixes #4349
#4337 6c8f41f8 Thanks @Skye-31! - Improve the error message when a script isn't exported a Durable Object class
Previously, wrangler would error with a message like Uncaught TypeError: Class extends value undefined is not a constructor or null. This improves that messaging to be more understandable to users.
7fbe1937 Thanks @jspspike! - Change local dev server default ip to * instead of 0.0.0.0. This will cause the dev server to listen on both ipv4 and ipv6 interfacesf867e01c Thanks @tmthecoder! - Support for hyperdrive bindings in local wrangler dev0453b447 Thanks @maxwellpeterson! - Allows uploads with both cron triggers and smart placement enabledIf a compatibility date greater than the installed version of workerd was configured, a warning would be logged. This warning was only actionable if a
#4209 24d1c5cf Thanks @mrbbot! - fix: suppress compatibility date fallback warnings if no wrangler update is available
If a compatibility date greater than the installed version of workerd was
configured, a warning would be logged. This warning was only actionable if a new
version of wrangler was available. The intent here was to warn if a user set
a new compatibility date, but forgot to update wrangler meaning changes
enabled by the new date wouldn't take effect. This change hides the warning if
no update is available.
It also changes the default compatibility date for wrangler dev sessions
without a configured compatibility date to the installed version of workerd.
This previously defaulted to the current date, which may have been unsupported
by the installed runtime.
#4135 53218261 Thanks @Cherry! - feat: resolve npm exports for file imports
Previously, when using wasm (or other static files) from an npm package, you would have to import the file like so:
import wasm from "../../node_modules/svg2png-wasm/svg2png_wasm_bg.wasm";
This update now allows you to import the file like so, assuming it's exposed and available in the package's exports field:
import wasm from "svg2png-wasm/svg2png_wasm_bg.wasm";
This will look at the package's exports field in package.json and resolve the file using resolve.exports.
#4232 69b43030 Thanks @romeupalos! - fix: use zone_name to determine a zone when the pattern is a custom hostname
In Cloudflare for SaaS, custom hostnames of third party domain owners can be used in Cloudflare.
Workers are allowed to intercept these requests based on the routes configuration.
Before this change, the same logic used by wrangler dev was used in wrangler deploy, which caused wrangler to fail with:
✘ [ERROR] Could not find zone for [partner-saas-domain.com]
b404ab70 Thanks @penalosa! - When uploading additional modules with your worker, Wrangler will now report the (uncompressed) size of each individual module, as well as the aggregate size of your Worker950bc401 Thanks @RamIdeas! - fix various logging of shell commands to correctly quote args when needed#4274 be0c6283 Thanks @jspspike! - chore: bump miniflare to 3.20231025.0
This change enables Node-like console.log()ing in local mode. Objects with
lots of properties, and instances of internal classes like Request, Headers,
ReadableStream, etc will now be logged with much more detail.
#4127 3d55f965 Thanks @mrbbot! - fix: store temporary files in .wrangler
As Wrangler builds your code, it writes intermediate files to a temporary
directory that gets cleaned up on exit. Previously, Wrangler used the OS's
default temporary directory. On Windows, this is usually on the C: drive.
If your source code was on a different drive, our bundling tool would generate
invalid source maps, breaking breakpoint debugging. This change ensures
intermediate files are always written to the same drive as sources. It also
ensures unused build outputs are cleaned up when running wrangler pages dev.
This change also means you no longer need to set cwd and
resolveSourceMapLocations in .vscode/launch.json when creating an attach
configuration for breakpoint debugging. Your .vscode/launch.json should now
look something like...
{
"configurations": [
{
"name": "Wrangler",
"type": "node",
"request": "attach",
"port": 9229,
// These can be omitted, but doing so causes silent errors in the runtime
"attachExistingChildren": false,
"autoAttachChildProcesses": false
}
]
}
05798038 Thanks @gabivlj! - Move helper cli files of C3 into @cloudflare/cli and make Wrangler and C3 depend on it#4235 46cd2df5 Thanks @mrbbot! - fix: ensure console.log()s during startup are displayed
Previously, console.log() calls before the Workers runtime was ready to
receive requests wouldn't be shown. This meant any logs in the global scope
likely weren't visible. This change ensures startup logs are shown. In particular,
this should fix Remix's HMR,
which relies on startup logs to know when the Worker is ready.
User limits provided via script metadata on upload
#4204 38fdbe9b Thanks @matthewdavidrodgers! - Support user limits for CPU time
User limits provided via script metadata on upload
Example configuration:
[limits]
cpu_ms = 20000
#2162 a1f212e6 Thanks @WalshyDev! - add support for service bindings in wrangler pages dev by providing the
new --service|-s flag which accepts an array of BINDING_NAME=SCRIPT_NAME
where BINDING_NAME is the name of the binding and SCRIPT_NAME is the name
of the worker (as defined in its wrangler.toml), such workers need to be
running locally with with wrangler dev.
For example if a user has a worker named worker-a, in order to locally bind
to that they'll need to open two different terminals, in each navigate to the
respective worker/pages application and then run respectively wrangler dev and
wrangler pages ./publicDir --service MY_SERVICE=worker-a this will add the
MY_SERVICE binding to pages' worker env object.
Note: additionally after the SCRIPT_NAME the name of an environment can be specified,
prefixed by an @ (as in: MY_SERVICE=SCRIPT_NAME@PRODUCTION), this behavior is however
experimental and not fully properly defined.
### Patch Changes - #4206 `8e927170` Thanks @1000hz! - chore: bump miniflare to `3.20231016.0` * #4144 `54800f6f` Thanks @a-robinson! - Log a warning
8e927170 Thanks @1000hz! - chore: bump miniflare to 3.20231016.054800f6f Thanks @a-robinson! - Log a warning when using a Hyperdrive binding in local wrangler dev### Patch Changes - #4171 `88f15f61` Thanks @penalosa! - patch: This release fixes some regressions related to running wrangler dev that were caused b
There are no changes required for developers to opt-in. Improvements include:
#3960 c36b78b4 Thanks @RamIdeas! - Refactoring the internals of wrangler dev servers (including wrangler dev, wrangler dev --remote and unstable_dev()).
There are no changes required for developers to opt-in. Improvements include:
When tailing a tail worker, messages previously had a null event property. Following https://github.com/cloudflare/workerd/pull/1248, these events hav
#4071 f880a009 Thanks @matthewdavidrodgers! - Support TailEvent messages in Tail sessions
When tailing a tail worker, messages previously had a null event property. Following https://github.com/cloudflare/workerd/pull/1248, these events have a valid event, specifying which scripts produced events that caused your tail worker to run.
As part of rolling this out, we're filtering out tail events in the internal tail infrastructure, so we control when these new messages are forward to tail sessions, and can merge this freely.
One idiosyncracy to note, however, is that tail workers always report an "OK" status, even if they run out of memory or throw. That is being tracked and worked on separately.
#2397 93833f04 Thanks @a-robinson! - feature: Support Queue consumer events in tail
So that it's less confusing when tailing a worker that consumes events from a Queue.
#2687 3077016f Thanks @jrf0110! - Fixes large Pages projects failing to complete direct upload due to expiring JWTs
For projects which are slow to upload - either because of client bandwidth or large numbers of files and sizes - It's possible for the JWT to expire multiple times. Since our network request concurrency is set to 3, it's possible that each time the JWT expires we get 3 failed attempts. This can quickly exhaust our upload attempt count and cause the entire process to bail.
This change makes it such that jwt refreshes do not count as a failed upload attempt.
f4d28918 Thanks @a-robinson! - Default new Hyperdrive configs for PostgreSQL databases to port 5432 if the port is not specifiedSetting 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.
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
Your coding agent can read these notes before it upgrades. Set up the MCP server →