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.
Previously, with the following in your wrangler.toml, an invalid types file would be generated:
#5091 6365c90 Thanks @Cherry! - fix: better handle dashes and other invalid JS identifier characters in wrangler types generation for vars, bindings, etc.
Previously, with the following in your wrangler.toml, an invalid types file would be generated:
[vars]
some-var = "foobar"
Now, the generated types file will be valid:
interface Env {
"some-var": "foobar";
}
#5748 27966a4 Thanks @penalosa! - fix: Load sourcemaps relative to the entry directory, not cwd.
#5746 1dd9f7e Thanks @petebacondarwin! - fix: suggest trying to update Wrangler if there is a newer one available after an unexpected error
#5226 f63e7a5 Thanks @DaniFoldi! - fix: remove second Wrangler banner from wrangler dispatch-namespace rename
Your coding agent can read these notes before it upgrades. Set up the MCP server →
allow getPlatformProxy to target environments by allowing users to specify an environment option
#5604 327a456 Thanks @dario-piotrowicz! - feat: add support for environments in getPlatformProxy
allow getPlatformProxy to target environments by allowing users to specify an environment option
Example usage:
const { env } = await getPlatformProxy({
environment: "production",
});
Today Pages cannot deploy Durable Objects itself. For this reason it is mandatory that when declaring Durable Objects bindings in the config file, the
#5666 81d9615 Thanks @CarmenPopoviciu! - fix: Fix Pages config validation around Durable Objects
Today Pages cannot deploy Durable Objects itself. For this reason it is mandatory that when declaring Durable Objects bindings in the config file, the script_name is specified. We are currently not failing validation if
script_name is not specified but we should. These changes fix that.
#5610 24840f6 Thanks @SuperchupuDev! - Mark ts-json-schema-generator as a dev dependency
#5669 a7e36d5 Thanks @dario-piotrowicz! - fix: fix broken Durable Object local proxying (when no cf property is present)
A regression was introduced in wrangler 3.46.0 (https://github.com/cloudflare/workers-sdk/pull/5215)
which made it so that missing Request#cf properties are serialized as "undefined", this in turn
throws a syntax parse error when such values are parsed via JSON.parse breaking the communication
with Durable Object local proxies. Fix such issue by serializing missing Request#cf properties as
"{}" instead.
#5616 c6312b5 Thanks @webbertakken! - fix: broken link to durable object migrations docs
#5482 1b7739e Thanks @DaniFoldi! - docs: show new Discord url everywhere for consistency. The old URL still works, but https://discord.cloudflare.com is preferred.
Updated dependencies [3a0d735, 1b7739e]:
### Patch Changes - #5652 `ccb9d3d` Thanks @petebacondarwin! - chore: re-release due to broken build
ccb9d3d Thanks @petebacondarwin! - chore: re-release due to broken buildIt's useful for Pages Plugins which want to declare a peer dependency.
#5477 9a46e03 Thanks @pmiguel! - feature: Changed Queues client to use the new QueueId and ConsumerId-based endpoints.
#5172 fbe1c9c Thanks @GregBrimble! - feat: Allow marking external modules (with --external) to avoid bundling them when building Pages Functions
It's useful for Pages Plugins which want to declare a peer dependency.
Currently pages functions build-env throws a fatal error if a config file does not exit, or if it is invalid. This causes issues for the CI system. We
#5587 d95450f Thanks @CarmenPopoviciu! - fix: pages functions build-env should throw error if invalid Pages config file is found
#5572 65aa21c Thanks @CarmenPopoviciu! - fix: fix pages function build-env to exit with code rather than throw fatal error
Currently pages functions build-env throws a fatal error if a config file does not exit, or if it is invalid. This causes issues for the CI system. We should instead exit with a specific code, if any of those situations arises.
#5291 ce00a44 Thanks @pmiguel! - feature: Added bespoke OAuth scope for Queues management.
08b4908]:
Excludes usage_model from wrangler.toml in all cases, since this field is deprecated and no longer used.
#5549 113ac41 Thanks @penalosa! - feat: Support wrangler pages secret put|delete|list|bulk
#5550 4f47f74 Thanks @penalosa! - feat: Generate a JSON schema for the Wrangler package & use it in templates
#5561 59591cd Thanks @ocsfrank! - feat: update R2 CreateBucket action to include the storage class in the request body
#5374 7999dd2 Thanks @maxwellpeterson! - fix: Improvements to --init-from-dash
Adds user-specified CPU limit to wrangler.toml if one exists. Excludes usage_model from wrangler.toml in all cases, since this field is deprecated and no longer used.
#5553 dcd65dd Thanks @rozenmd! - fix: refactor d1's time-travel compatibility check
#5380 57d5658 Thanks @GregBrimble! - fix: Respect --no-bundle when deploying a _worker.js/ directory in Pages projects
#5536 a7aa28a Thanks @Cherry! - fix: resolve a regression where wrangler pages dev would bind to port 8787 by default instead of 8788 since wrangler@3.38.0
Updated dependencies [9575a51]:
Wrangler supports an -s flag that allows the user to specify a storage class when creating a bucket, changing the default storage class of a bucket, a
#5429 c5561b7 Thanks @ocsfrank! - R2 will introduce storage classes soon. Wrangler allows you to interact with storage classes once it is
enabled on your account.
Wrangler supports an -s flag that allows the user to specify a storage class when creating a bucket,
changing the default storage class of a bucket, and uploading an object.
wrangler r2 bucket create ia-bucket -s InfrequentAccess
wrangler r2 bucket update storage-class my-bucket -s InfrequentAccess
wrangler r2 object put bucket/ia-object -s InfrequentAccess --file foo
Updated dependencies [`9f15ce1`]:
9f15ce1]:
### Minor Changes - #5506 `7734f80` Thanks @penalosa! - feat: Add interactive prompt to wrangler pages download config if an existing wrangler.toml fi
Adds the source_maps boolean config option. When enabled, source maps included in the build output are uploaded alongside the built code modules. Uplo
#5282 b7ddde1 Thanks @maxwellpeterson! - feature: Add source map support for Workers
Adds the source_maps boolean config option. When enabled, source maps included in the build output are uploaded alongside the built code modules. Uploaded source maps can then be used to remap stack traces emitted by the Workers runtime.
#5215 cd03d1d Thanks @GregBrimble! - feature: support named entrypoints in service bindings
This change allows service bindings to bind to a named export of another Worker. As an example, consider the following Worker named bound:
import { WorkerEntrypoint } from "cloudflare:workers";
export class EntrypointA extends WorkerEntrypoint {
fetch(request) {
return new Response("Hello from entrypoint A!");
}
}
export const entrypointB: ExportedHandler = {
fetch(request, env, ctx) {
return new Response("Hello from entrypoint B!");
},
};
export default <ExportedHandler>{
fetch(request, env, ctx) {
return new Response("Hello from the default entrypoint!");
},
};
Up until now, you could only bind to the default entrypoint. With this change, you can bind to EntrypointA or entrypointB too using the new entrypoint option:
[[services]]
binding = "SERVICE"
service = "bound"
entrypoint = "EntrypointA"
To bind to named entrypoints with wrangler pages dev, use the # character:
$ wrangler pages dev --service=SERVICE=bound#EntrypointA
#5215 cd03d1d Thanks @GregBrimble! - fix: ensure request url and cf properties preserved across service bindings
Previously, Wrangler could rewrite url and cf properties when sending requests via service bindings or Durable Object stubs. To match production behaviour, this change ensures these properties are preserved.
Updated dependencies [cd03d1d, 6c3be5b, cd03d1d, cd03d1d]:
As we are adding wrangler.toml support for Pages, we want to ensure that wrangler pages deploy works with a configuration file.
#5377 5d68744 Thanks @CarmenPopoviciu! - feat: Add wrangler.toml support in wrangler pages deploy
As we are adding wrangler.toml support for Pages, we want to ensure that wrangler pages deploy works with a configuration file.
#5471 489b9c5 Thanks @zebp! - feature: Add version-id filter for Worker tailing to filter logs by scriptVersion in a gradual deployment
This allows users to only get logs in a gradual deployment if you are troubleshooting issues
specific to one deployment. Example:
npx wrangler tail --version-id 72d3f357-4e52-47c5-8805-90be978c403f
#5462 68faf67 Thanks @OilyLime! - revert: Removes support for private networking Hyperdrive configs, pending more work to support the feature. Non-breaking change since the feature wasn't yet supported.
#5494 a232ccf Thanks @penalosa! - fix: Swallow parsing errors when a pages config file is required.
#5484 e7f8dc3 Thanks @ichernetsky-cf! - feature: support Cloudchamber deployment labels
#5434 bf9dca8 Thanks @OilyLime! - bugfix: Fix passing Hyperdrive caching options to backend
#5403 5d6d521 Thanks @oliy! - fix: wrangler dev --local support for ratelimits
Updated dependencies [940ad89]:
This allows users to see the entire event notification configuration -- i.e. every rule for every configured queue -- for a single bucket with a singl
#5461 f69e562 Thanks @mattdeboard! - feature: Add command for fetching R2 Event Notification configurations for a given bucket
This allows users to see the entire event notification configuration -- i.e. every rule for every configured queue -- for a single bucket with a single request.
This change also improves messaging of console output when creating a new bucket notification.
### Minor Changes - #5466 `ef9fbba` Thanks @celso! - feature: add Workers AI finetune commands ### Patch Changes - #5449 `91a2150` Thanks @penalosa! -
Previously, to get the correct Workers AI API, you needed to wrap your env.AI binding with new Ai() from @cloudflare/ai. This change moves the content
#5371 77152f3 Thanks @G4brym! - feature: remove requirement for @cloudflare/ai package to use Workers AI
Previously, to get the correct Workers AI API, you needed to wrap your env.AI binding with new Ai() from @cloudflare/ai. This change moves the contents of @cloudflare/ai into the Workers runtime itself, meaning env.AI is now an instance of Ai, without the need for wrapping.
d994066]:
### Minor Changes - #5425 `b7a6d9d` Thanks @rozenmd! - feat: implement wrangler d1 export
Since the original command was not yet operational, this update does not constitute a breaking change.
#5426 9343714 Thanks @RamIdeas! - feature: added a new wrangler triggers deploy command
This command currently requires the --experimental-versions flag.
This command extracts the trigger deployment logic from wrangler deploy and allows users to update their currently deployed Worker's triggers without doing another deployment. This is primarily useful for users of wrangler versions upload and wrangler versions deploy who can then run wrangler triggers deploy to apply trigger changes to their currently deployed Worker Versions.
The command can also be used even if not using the wrangler versions ... commands. And, in fact, users are already using it implicitly when running wrangler deploy.
#4932 dc0c1dc Thanks @xortive! - feature: Add support for private networking in Hyperdrive configs
#5369 7115568 Thanks @mattdeboard! - fix: Use queue name, not ID, for r2 bucket event-notification subcommands
Since the original command was not yet operational, this update does not constitute a breaking change.
Instead of providing the queue ID as the parameter to --queue, users must provide the queue name. Under the hood, we will query the Queues API for the queue ID given the queue name.
#5413 976adec Thanks @pmiguel! - feature: Added Queue delivery controls support in wrangler.toml
#5412 3e5a932 Thanks @RamIdeas! - feature: adds the --json option to wrangler deployments list --experimental-versions, wrangler deployments status --experimental-versions, wrangler versions list --experimental-versions and wrangler versions view --experimental-versions which will format the output as clean JSON. The --experimental-versions flag is still required for these commands.
#5258 fbdca7d Thanks @OilyLime! - feature: URL decode components of the Hyperdrive config connection string
#5416 47b325a Thanks @mattdeboard! - fix: minor improvements to R2 notification subcommand
r2 bucket event-notification <subcommand> becomes r2 bucket notification <subcommand>--event-type use - instead of _ (e.g. object_create -> object-create)Since the original command was not yet operational, this update does not constitute a breaking change.
#5419 daac6a2 Thanks @RamIdeas! - chore: add helpful logging to --experimental-versions commands
#5400 c90dd6b Thanks @RamIdeas! - chore: log of impending change of "Deployment ID" to "Version ID" in wrangler deploy, wrangler deployments list, wrangler deployments view and wrangler rollback. This is a warning of a future change for anyone depending on the output text format, for example by grepping the output in automated flows.
#5422 b341614 Thanks @geelen! - fix: remove d1BetaWarning and all usages
This PR removes the warning that D1 is in beta for all D1 commands.
Updated dependencies [fbdca7d]:
Please note, the experimental-versions flag is required to use the new behaviour. The original wrangler rollback command is unchanged if run without t
#5373 5bd8db8 Thanks @RamIdeas! - feature: Implement versioned rollbacks via wrangler rollback [version-id] --experimental-versions.
Please note, the experimental-versions flag is required to use the new behaviour. The original wrangler rollback command is unchanged if run without this flag.
#5366 e11e169 Thanks @RamIdeas! - fix: save non-versioned script-settings (logpush, tail_consumers) on wrangler versions deploy. This command still requires --experimental-versions.
#5405 7c701bf Thanks @RamIdeas! - chore: add wrangler deployments view [deployment-id] --experimental-versions command
This command will display an error message which points the user to run either wrangler deployments status --experimental-versions or wrangler versions view <version-id> --experimental-versions instead.
As we are adding wrangler.toml support for Pages, we want to ensure that wrangler pages dev works with a configuration file.
#5310 528c011 Thanks @penalosa! - feat: Watch the entire module root for changes in --no-bundle mode, rather than just the entrypoint file.
#5327 7d160c7 Thanks @penalosa! - feat: Add wrangler pages download config
#5284 f5e2367 Thanks @CarmenPopoviciu! - feat: Add wrangler.toml support in wrangler pages dev
As we are adding wrangler.toml support for Pages, we want to ensure that wrangler pages dev works with a configuration file.
#5353 3be826f Thanks @penalosa! - feat: Updates wrangler pages functions build to support using configuration from wrangler.toml in the generated output.
#5102 ba52208 Thanks @pmiguel! - feature: add support for queue delivery controls on wrangler queues create
Included are commands for creating and deleting event notification configurations for individual buckets.
#5294 bdc121d Thanks @mattdeboard! - feature: Add event-notification commands in support of event notifications for Cloudflare R2.
Included are commands for creating and deleting event notification configurations for individual buckets.
#5231 e88ad44 Thanks @w-kuhn! - feature: Add support for configuring HTTP Pull consumers for Queues
HTTP Pull consumers can be used to pull messages from queues via https request.
#5317 9fd7eba Thanks @GregBrimble! - chore: Deprecate -- <command>, --proxy and --script-path options from wrangler pages dev.
Build your application to a directory and run the wrangler pages dev <directory> instead. This results in a more faithful emulation of production behavior.
Updated dependencies [248a318]:
For Pages, Wrangler will not require both of the supported named environments ("preview" | "production") to be explicitly defined in the config file.
#5234 e739b7f Thanks @CarmenPopoviciu! - feat: Implement environment inheritance for Pages configuration
For Pages, Wrangler will not require both of the supported named environments ("preview" | "production") to be explicitly defined in the config file. If either [env.production] or [env.preview] is left unspecified, Wrangler will use the top-level environment when targeting that named Pages environment.
#5306 c60fed0 Thanks @taylorlee! - fix: Remove triggered_by annotation from experimental versions deploy command which is now set by the API and cannot be set by the client.
#5321 ac93411 Thanks @RamIdeas! - fix: rename --experimental-gradual-rollouts to --experimental-versions flag
The --experimental-gradual-rollouts flag has been made an alias and will still work.
And additional shorthand alias --x-versions has also been added and will work too.
#5324 bfc4282 Thanks @penalosa! - fix: Ignore OPTIONS requests in Wrangler's oauth server
In Chrome v123, the auth requests from the browser back to wrangler now first include a CORS OPTIONS preflight request before the expected GET request. Wrangler was able to successfully complete the login with the first (OPTIONS) request, and therefore upon the second (GET) request, errored because the token exchange had already occured and could not be repeated.
Wrangler now stops processing the OPTIONS request before completing the token exchange and only proceeds on the expected GET request.
If you see a ErrorInvalidGrant in a previous wrangler version when running wrangler login, please try upgrading to this version or later.
#5099 93150aa Thanks @KaiSpencer! - feat: expose --show-interactive-dev-session flag
This flag controls the interactive mode of the dev session, a feature that already exists internally but was not exposed to the user.
This is useful for CI/CD environments where the interactive mode is not desired, or running in tools like turbo and nx.
wrangler version is an undocumented alias for wrangler --version. It is being deprecated in favour of the more conventional flag syntax to avoid confu…
#5166 133a190 Thanks @CarmenPopoviciu! - feat: Implement config file validation for Pages projects
Wrangler proper has a mechanism in place through which it validates a wrangler.toml file for Workers projects. As part of adding wrangler toml support for Pages, we need to put a similar mechanism in place, to validate a configuration file against Pages specific requirements.
#5279 0a86050 Thanks @penalosa! - feat: Support the hidden command wrangler pages functions build-env
#5093 a676f55 Thanks @benycodes! - feature: add --dispatch-namespace to wrangler deploy to support uploading Workers directly to a Workers for Platforms dispatch namespace.
#5275 e1f2576 Thanks @petebacondarwin! - fix: ensure tail exits when the WebSocket disconnects
Previously when the tail WebSocket disconnected, e.g. because of an Internet failure,
the wrangler tail command would just hang and neither exit nor any longer receive tail messages.
Now the process exits with an exit code of 1, and outputs an error message.
The error message is formatted appropriately, if the tail format is set to json.
Fixes #3927
#5069 8f79981 Thanks @RamIdeas! - chore: deprecate wrangler version command
wrangler version is an undocumented alias for wrangler --version. It is being deprecated in favour of the more conventional flag syntax to avoid confusion with a new (upcoming) wrangler versions command.
Updated dependencies [1720f0a]:
### 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]:
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 specifiedOne column per quarter.