Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
[email protected]
Patch Changes
#992
ee6b413
Thanks @petebacondarwin! - fix: add warning tofetch()
calls that will change the requested portIn Workers published to the Edge (rather than previews) there is a bug where a custom port on a downstream fetch request is ignored, defaulting to the standard port.
For example,
https://my.example.com:668
will actually send the request tohttps://my.example.com:443
.This does not happen when using
wrangler dev
(both in remote and local mode), but to ensure that developers are aware of it this change displays a runtime warning in the console when the bug is hit.Closes Fetch ignoring port #1320
#1378
2579257
Thanks @rozenmd! - chore: fully deprecate thepreview
commandBefore, we would warn folks that
preview
was deprecated in favour ofdev
, but then randev
on their behalf.To avoid maintaining effectively two versions of the
dev
command, we're now just telling folks to rundev
.#1213
1bab3f6
Thanks @threepointone! - fix: passroutes
todev
sessionWe can pass routes when creating a
dev
session. The effect of this is when you visit a path that doesn't match the given routes, then it instead does a fetch from the deployed worker on that path (if any). We were previously passing*/*
, i.e, matching all routes in dev; this fix now passes configured routes instead.#1374
215c4f0
Thanks @threepointone! - feat: commands to manage worker namespacesThis adds commands to create, delete, list, and get info for "worker namespaces" (name to be bikeshed-ed). This is based on work by @aaronlisman in feat: implement 'dispatch namespaces' #1310.
#1403
9c6c3fb
Thanks @threepointone! - feat:config.no_bundle
as a configuration option to prevent bundlingAs a configuration parallel to
--no-bundle
(introduced in feat:--no-build
#1300 as--no-build
, renamed in fix: rename--no-build
to--no-bundle
#1399 to--no-bundle
), this introduces a configuration fieldno_bundle
to prevent bundling of the worker before it's published. It's inheritable, which means it can be defined inside environments as well.#1355
61c31a9
Thanks @williamhorning! - fix: Fallback to non-interactive mode on errorIf the terminal isn't a TTY, fallback to non-interactive mode instead of throwing an error. This makes it so users of Bash on Windows can pipe to wrangler without an error being thrown.
resolves 🐛 BUG: Can't pipe to
wrangler secret put
#1303#1337
1d778ae
Thanks @JacobMGEvans! - polish: bundle reporter was not printing during publish errorsThe reporter is now called before the publish API call, printing every time.
resolves 🚀 Feature Request: Report bundle/gzip size even on wrangler publish error #1328
#1393
b36ef43
Thanks @threepointone! - chore: enable node's experimental fetch flagWe'd previously had some funny behaviour with undici clashing with node's own fetch supporting classes, and had turned off node's fetch implementation. Recent updates to undici appear to have fixed the issue, so let's turn it back on.
Closes bug: node 18 breaks wrangler2 when experimental
fetch
is enabled #834#1335
49cf17e
Thanks @JacobMGEvans! - feat: resolve--assets
cli arg relative to current working directoryBefore we were resolving the Asset directory relative to the location of
wrangler.toml
at all times.Now the
--assets
cli arg is resolved relative to current working directory.resolves FEAT:
--asset
should resolve relative to cwd, not wrangler.toml #1333#1350
dee034b
Thanks @rozenmd! - feat: export an (unstable) function that folks can use in their own scripts to invoke wrangler's dev CLICloses feat: export a dev function that folks can use in their own scripts to invoke wrangler dev #1350
#1342
6426625
Thanks @rozenmd! - polish: split dev function out of index.tsx#1401
6732d95
Thanks @threepointone! - fix: log pubsub beta usage warnings consistentlyThis fix makes sure the pubsub beta warnings are logged consistently, once per help menu, through the hierarchy of its command tree.
Fixes 🐛 BUG: Pub/Sub .epilogue only outputs on top-level
--help
#1370#1344
7ba19fe
Thanks @rozenmd! - polish: move init into its own file#1386
4112001
Thanks @rozenmd! - feat: implement fetch for wrangler's unstable_dev API, and write our first integration test.Prior to this PR, users of
unstable_dev
had to provide their own fetcher, and guess the address and port that the wrangler dev server was using.With this implementation, it's now possible to test wrangler, using just wrangler (and a test framework):
Closes Enhancement: API/unstable_dev should expose a fetch() function #1383
Closes Enhancement: API/unstable_dev needs tests #1384
Closes 🐛 BUG: API/unstable_dev's stop() usage of process.exit(0) kills jest #1385
#1399
1ab71a7
Thanks @threepointone! - fix: rename--no-build
to--no-bundle
This fix renames the
--no-build
cli arg to--no-bundle
.no-build
wasn't a great name because it would imply that we don't run custom builds specified under[build]
which isn't true. So we rename closer to what wrangler actually does, which is bundling the input. This also makes it clearer that it's a single file upload.#1278
8201733
Thanks @Maximo-Guk! - Throw error if user attempts to use config with pages#1398
ecfbb0c
Thanks @threepointone! - Added support for pubsub namespace (via @elithrar in Pub/Sub: add wrangler pubsub commands #1314)This adds support for managing pubsub namespaces and brokers (https://developers.cloudflare.com/pub-sub/)
#1348
eb948b0
Thanks @threepointone! - polish: add an experimental warning if--assets
is usedWe already have a warning when
config.assets
is used, this adds it for the cli argument as well.#1326
12f2703
Thanks @timabb031! - fix: show console.error/console.warn logs when usingdev --local
.Prior to this change, logging with console.error/console.warn in a Worker wouldn't output anything to the console when running in local mode. This was happening because stderr data event handler was being removed after the
Debugger listening...
string was found.This change updates the stderr data event handler to forward on all events to
process.stderr
.Closes 🐛 BUG: console error/warn messages aren't visible in the console when using local mode #1324
#1309
e5a6aca
Thanks @petebacondarwin! - style: convert all source code indentation to tabsFixes Switch to hard tabs for indentation #1298
#1395
88f2702
Thanks @threepointone! - feat: cache account id selectionThis adds caching for account id fetch/selection for all wrangler commands.
Currently, if we have an api/oauth token, but haven't provided an account id, we fetch account information from cloudflare. If a user has just one account id, we automatically choose that. If there are more than one, then we show a dropdown and ask the user to pick one. This is convenient, and lets the user not have to specify their account id when starting a project.
However, if does make startup slow, since it has to do that fetch every time. It's also annoying for folks with multiple account ids because they have to pick their account id every time.
So we now cache the account details into
node_modules/.cache/wrangler
(much like pages already does with account id and project name).This patch also refactors
config-cache.ts
; it only caches if there's anode_modules
folder, and it looks for the closest node_modules folder (and not directly in cwd). I also added tests for when anode_modules
folder isn't available. It also trims the message that we log to terminal.Closes cache some calls in
node_modules/.cache
(specifically - account selection, but maybe more) #300#1391
ea7ee45
Thanks @threepointone! - fix: create a single session during remote devPreviously, we would be creating a fresh session for every script change during remote dev. While this worked, it makes iterating slower, and unnecessarily discards state. This fix makes it so we create only a single session for remote dev, and reuses that session on every script change. This also means we can use a single script id for every worker in a session (when a name isn't already given). Further, we also make the prewarming call of the preview space be non-blocking.
Fixes feat: use a single dev session during
wrangler dev
across all script changes. #1191#1365
b9f7200
Thanks @threepointone! - fix: normaliseaccount_id = ''
toaccount_id: undefined
In older templates, (i.e made for wrangler 1.x),
account_id =''
is considered as a valid input, but then ignored. With wrangler 2, when running wrangler dev, we log an error, but it fixes itself after we get an account id. Much like 🐛 BUG: allowroute
setting to be empty string #1329, the fix here is to normalise that value when we see it, and replace it withundefined
while logging a warning.This fix also tweaks the messaging for a blank route value to suggest some user action.
#1360
cd66b67
Thanks @SirCremefresh! - Updated eslint to version 0.14.47#1363
b2c2c2b
Thanks @petebacondarwin! - fix: display email from process env in whoami and display better error when lacking permissions#1343
59a83f8
Thanks @rozenmd! - polish: split generate into its own file#1300
dcffc93
Thanks @threepointone! - feat:publish --no-build
This adds a
--no-build
flag towrangler publish
. We've had a bunch of people asking to be able to upload a worker directly, without any modifications. While there are tradeoffs to this approach (any linked modules etc won't work), we understand that people who need this functionality are aware of it (and the usecases that have presented themselves all seem to match this).#1392
ff2e7cb
Thanks @threepointone! - fix: keep site upload batches under 98 mbThe maximum request size for a batch upload is 100 MB. We were previously calculating the upload key value to be under 100 MiB. Further, with a few bytes here and there, the size of the request can exceed 100 MiB. So this fix calculate using MB instead of MiB, but also brings down our own limit to 98 MB so there's some wiggle room for uploads.
Fixes 🐛 BUG: 413 Request Entity Too Large #1367
#1377
a6f1cee
Thanks @threepointone! - feat: bind a worker with[worker_namespaces]
This feature les you bind a worker to a dynamic dispatch namespaces, which may have other workers bound inside it. (See https://blog.cloudflare.com/workers-for-platforms/). Inside your
wrangler.toml
, you would addBased on work by @aaronlisman in feat: implement 'dispatch namespaces' #1310
#1297
40036e2
Thanks @threepointone! - feat: implementconfig.define
This implements
config.define
. This lets the user define a map of keys to strings that will be substituted in the worker's source. This is particularly useful when combined with environments. A common usecase is for values that are sent along with metrics events; environment name, public keys, version numbers, etc. It's also sometimes a workaround for the usability of module env vars, which otherwise have to be threaded through request function stacks.8d68226
Thanks @threepointone! - feat: add support for pubsub commands (via @elithrar and @netcli in Pub/Sub: add wrangler pubsub commands #1314)#1351
c770167
Thanks @geelen! - feat: add support for CLOUDFLARE_API_KEY + CLOUDFLARE_EMAIL to authoriseThis adds support for using the CLOUDFLARE_API_KEY + CLOUDFLARE_EMAIL env vars for authorising a user. This also adds support for CF_API_KEY + CF_EMAIL from wrangler 1, with a deprecation warning.
#1352
4e03036
Thanks @JacobMGEvans! - bugfix: Allow route setting to be""
Previously Wrangler1 behavior had allowed for
route = ""
. To keep parity it will be possible to setroute = ""
in the config file and represent not setting a route, while providing a warning.resolves 🐛 BUG: allow
route
setting to be empty string #13294ad084e
Thanks @sbquinlan! - feature By @sbquinlan: Set "upstream" miniflare option when running dev in local mode#1274
5cc0772
Thanks @Maximo-Guk! - Added .dev.vars support for pages#1349
ef9dac8
Thanks @rozenmd! - polish: move preview into its own file