-
#1937
905fce4f
Thanks @JacobMGEvans! - fix: fails to publish due to empty migrations After this change,wrangler init --from-dash
will not attempt to add durable object migrations towrangler.toml
for Workers that don't have durable objects.fixes #1854
-
#1943
58a430f2
Thanks @cameron-robey! - chore: addenv
andctx
params tofetch
in javascript example templateJust like in the typescript templates, and the javascript template for scheduled workers, we include
env
andctx
as parameters to thefetch
export. This makes it clearer where environment variables live.
-
#1939
5854cb69
Thanks @rozenmd! - fix: respect variable binding type when printingAfter this change, when printing the bindings it has access to, wrangler will correctly only add quotes around string variables, and serialize objects via JSON.stringify (rather than printing
"[object Object]"
).
-
#1930
56798155
Thanks @rozenmd! - fix: use node http instead of faye-websocket in proxy serverWe change how websockets are handled in the proxy server, fixing multiple issues of websocket behaviour, particularly to do with headers.
In particular this fixes:
- the protocol passed between the client and the worker was being stripped out by wrangler
- wrangler was discarding additional headesr from websocket upgrade response
- websocket close code and reason was not being propagated by wrangler
- #1894
ed646cf9
Thanks @mrbbot! - Add experimental support for using the open-source Workers runtimeworkerd
inwrangler dev
. Usewrangler dev --experimental-local
to try it out! 🚀 Note this feature is still under active development.
- #1881
6ff5a030
Thanks @Skye-31! - Chore: correctly log all listening ports on remote mode (closes #1652)
-
#1913
9f7cc5a0
Thanks @threepointone! - feat: expose port and address on (Unstable)DevWorkerwhen using
unstable_dev()
, I think we want to expose the port/address that the server has started on. The usecase is when trying to connect to the server without calling.fetch()
(example: when making a websocket connection).
-
#1911
16c28502
Thanks @rozenmd! - fix: put config cache log behind logger.debugPrior to this change, wrangler would print
Retrieving cached values for...
after almost every single command.After this change, you'll only see this message if you add
WRANGLER_DEBUG=true
before your command.Closes #1808
-
#1895
1b53bf9d
Thanks @rozenmd! - fix: rename keep_bindings to keep_vars, and make it opt-in, to keep wrangler.toml compatible with being used for Infrastructure as CodeBy default, wrangler.toml is the source of truth for your environment configuration, like a terraform file.
If you change your settings (particularly your vars) in the dashboard, wrangler will override them. If you want to disable this behavior, set this field to true.
Between wrangler 2.0.28 and 2.1.5, by default wrangler would not delete your vars by default, breaking expected wrangler.toml behaviour.
- #1889
98f756c7
Thanks @penalosa! - fix: Correctly place the.wrangler/state
local state directory in the same directory aswrangler.toml
by default
-
#1886
8b647175
Thanks @JacobMGEvans! - fix: potential missing compatibility_date in wrangler.toml when runningwrangler init --from-dash
Fixed a bug where compatibility_date wasn't being added to wrangler.toml when initializing a worker viawrangler init --from-dash
fixes #1855
- #1819
d8a18070
Thanks @CarmenPopoviciu! - Adds support for custom _routes.json when runningwrangler pages dev
-
#1815
d8fe95d2
Thanks @cameron-robey! - feat: testing scheduled events withwrangler dev
remote modeUsing the new middleware (#1735), we implement a way of testing scheduled workers from a fetch using
wrangler dev
in remote mode, by passing a new command line flag--test-scheduled
. This exposes a route/__scheduled
which will trigger the scheduled event.$ npx wrangler dev index.js --test-scheduled $ curl http://localhost:8787/__scheduled
Closes #570
-
#1801
07fc90d6
Thanks @rozenmd! - feat: multi-worker testingThis change introduces the ability to test multi-worker setups via the wrangler API's unstable_dev function.
Usage:
import { unstable_dev } from "wrangler"; /** * Note: if you shut down the first worker you spun up, * the parent worker won't know the child worker exists * and your tests will fail */ describe("multi-worker testing", () => { let childWorker; let parentWorker; beforeAll(async () => { childWorker = await unstable_dev( "src/child-worker.js", { config: "src/child-wrangler.toml" }, { disableExperimentalWarning: true } ); parentWorker = await unstable_dev( "src/parent-worker.js", { config: "src/parent-wrangler.toml" }, { disableExperimentalWarning: true } ); }); afterAll(async () => { await childWorker.stop(); await parentWorker.stop(); }); it("childWorker should return Hello World itself", async () => { const resp = await childWorker.fetch(); if (resp) { const text = await resp.text(); expect(text).toMatchInlineSnapshot(`"Hello World!"`); } }); it("parentWorker should return Hello World by invoking the child worker", async () => { const resp = await parentWorker.fetch(); if (resp) { const parsedResp = await resp.text(); expect(parsedResp).toEqual("Parent worker sees: Hello World!"); } }); });
-
#1865
adfc52d6
Thanks @JacobMGEvans! - polish: loglevel flag Added a '--log-level' flag that allows the user to specify between 'debug', 'info', 'log', 'warning', 'error', 'none' Currently 'none' will turn off all outputs in Miniflare (local mode), however, Wrangler will still output Errors.resolves #185
- #1861
3d51d553
Thanks @GregBrimble! - fix: Add 'charset' to 'Content-Type' on 'wrangler pages dev' responses
- #1867
5a6ccc58
Thanks @cameron-robey! - fix: handle logging of empty map/set/weak-map/weak-set
-
#1839
2660872a
Thanks @cameron-robey! - feat: make it possible to specify a path forunstable_dev()
's fetch methodconst worker = await unstable_dev( "script.js" ); const res = await worker.fetch(req);
where
req
can be anything fromRequestInfo
:string | URL | Request
.
-
#1851
afca1b6c
Thanks @cameron-robey! - feat: summary output for secret:bulkWhen wrangler
secret:bulk <json>
is run, a summary is outputted at the end with the number of secrets successfully / unsuccessfully created.
- #1846
f450e387
Thanks @rozenmd! - fix: when runningwrangler init
, add atest
script to package.json when the user asks us to write their first test
- #1779
974f3311
Thanks @WalshyDev! - Add debug outputs to the exchange request
-
#1836
3583f313
Thanks @rozenmd! - fix: wrangler publish for CI after a manual deploymentPrior to this change, if you edited your Worker via the Cloudflare Dashboard, then used CI to deploy your script,
wrangler publish
would fail.This change logs a warning that your manual changes are going to be overriden, but doesn't require user input to proceed.
Closes #1832
-
#1644
dc1c9595
Thanks @geelen! - Deprecated --experimental-enable-local-persistence.Added --persist and --persist-to in its place. Changed the default persistence directory to .wrangler/state, relative to wrangler.toml.
To migrate to the new flag, run
mkdir -p .wrangler && mv wrangler-local-state .wrangler/state
then use--persist
. Alternatively, you can use--persist-to=./wrangler-local-state
to keep using the files in the old location.
- #1833
b1622395
Thanks @GregBrimble! - fix: _headers and _redirects parsing in 'wrangler pages dev'
-
#1827
32a58fee
Thanks @JacobMGEvans! - fix: Publish error when deploying new WorkersThis fix adds a try/catch when checking when the Worker was last deployed.
The check was failing when a Worker had never been deployed, causing deployments of new Workers to fail.
fixes #1824
-
#1799
a89786ba
Thanks @JacobMGEvans! - feat: Bulk Secret Upload Created a flag that allows for passing in a JSON file with key/value's of secrets.resolve #1610
- #1713
82451e9d
Thanks @jspspike! - Tail now uses updated endpoint. Allows tailing workers that are above the normal "invocations per second" limit when using the--ip self
filter.
-
#1782
cc43e3c4
Thanks @jahands! - fix: Update Pages test to assert version in package.jsonThis test was asserting a hardcoded wrangler version which broke after release.
-
#1786
1af49b68
Thanks @rozenmd! - fix: refactor unstable_dev to avoid race conditions with portsPrior to this change, wrangler would check to see if a port was available, do a bit more work, then try use that port when starting miniflare. With this change, we're using port 0 to tell Node to assign us a random free port.
To make this change work, we had to do some plumbing so miniflare can tell us the host and port it's using, so we can call fetch against it.
-
#1788
152a1e81
Thanks @GregBrimble! - chore: Refactor 'wrangler pages dev' to use the same code as we do in productionThis will make our dev implementation an even closer simulation of production, and will make maintenance easier going forward.
-
#1789
b21ee41a
Thanks @JacobMGEvans! - fix: getMonth compatibility date Set correct month forcompatibility_date
when initializing a new Workerresolves #1766
- #1694
3fb730a3
Thanks @yjl9903! - feat: starting pages dev server doesn't require command when proxy port provided
-
#1729
ebb5b88f
Thanks @JacobMGEvans! - feat: autogenerated config from dashMakes
wrangler init
's--from-dash
option pull in data from Cloudflare's dashboard to generate a wrangler.toml file populated with configuration from an existing Worker. This is a first step towards makingwrangler init
more useful for folks who are already using Cloudflare's products on the Dashboard.related discussion #1623 resolves #1638
-
#1781
603d0b35
Thanks @JacobMGEvans! - feat: Publish Origin Messaging feat: warn about potential conflicts duringpublish
andinit --from-dash
.- If publishing to a worker that has been modified in the dashboard, warn that the dashboard changes will be overwritten.
- When initializing from the dashboard, warn that future changes via the dashboard will not automatically appear in the local Worker config.
resolves #1737
-
#1735
de29a445
Thanks @cameron-robey! - feat: new internal middlewareA new way of registering middleware that gets bundled and executed on the edge.
- the same middleware functions can be used for both modules workers and service workers
- only requires running esbuild a fixed number of times, rather than for each middleware added
- #1731
16f051d3
Thanks @CarmenPopoviciu! - Add custom _routes.json support for Pages Functions projects
-
#1762
23f89216
Thanks @petebacondarwin! - Use getBasePath() when trying to specify paths to files relative to the base of the Wrangler package directory rather than trying to compute the path from Node.js constants like **dirname and **filename. This is because the act of bundling the source code can move the file that contains these constants around potentially breaking the relative path to the desired files.Fixes #1755
-
#1763
75f3ae82
Thanks @CarmenPopoviciu! - Adddescription
field to _routes.jsonWhen generating routes for Functions projects, let's add a description so we know what wrangler version generated this config
-
#1538
2c9caf74
Thanks @rozenmd! - chore: refactor wrangler.dev API to not need React/InkPrior to this change,
wrangler.unstable_dev()
would only support running one instance of wrangler at a time, as Ink only lets you render one instance of React. This resulted in test failures in CI.This change creates pure JS/TS versions of these React hooks:
- useEsbuild
- useLocalWorker
- useCustomBuild
- useTmpDir
As a side-effect of removing React, tests should run faster in CI.
Closes #1432 Closes #1419
- #1775
8163b8cf
Thanks @CarmenPopoviciu! - Add unit tests forwrangler pages publish
-
#1725
eb75413e
Thanks @threepointone! - rename:worker_namespaces
/dispatch_namespaces
The Worker-for-Platforms team would like to rename this field to more closely match what it's called internally. This fix does a search+replace on this term. This feature already had an experimental warning, and no one's using it at the moment, so we're not going to add a warning/backward compat for existing customers.
-
#1736
800f8553
Thanks @threepointone! - fix: do not delete previously defined plain_text/json bindings on publishCurrently, when we publish a worker, we delete an pre-existing bindings if they're not otherwise defined in
wrangler.toml
, and overwrite existing ones. But folks may be deploying with wrangler, and changing environment variables on the fly (like marketing messages, etc). It's annoying when deploying via wrangler blows away those values.This patch fixes one of those issues. It will not delete any older bindings that are not in wrangler.toml. It still does overwrite existing vars, but at least this gives a way for developers to have some vars that are not blown away on every publish.
-
#1726
0b83504c
Thanks @GregBrimble! - fix: Multiworker and static asset dev bug preventing both from being usedThere was previously a collision on the generated filenames which resulted in the generated scripts looping and crashing in Miniflare with error code 7. By renaming one of the generated files, this is avoided.
-
#1718
02f1fe9b
Thanks @threepointone! - fix: useconfig.dev.ip
when providedBecause we'd used a default for 0.0.0.0 for the
--ip
flag,wrangler dev
was overriding the value specified inwrangler.toml
underdev.ip
. This fix removes the default value (since it's being set when normalising config anyway).Fixes #1714
-
#1727
3f9e8f63
Thanks @rozenmd! - fix: refresh token when we detect that the preview session has expired (error code 10049)When running
wrangler dev
, from time to time the preview session token would expire, and the dev server would need to be manually restarted. This fixes this, by refreshing the token when it expires.Closes #1446
-
#1730
27ad80ee
Thanks @threepointone! - feat:--var name:value
and--define name:value
This enables passing values for
[vars]
and[define]
via the cli. We have a number of usecases where the values to be injected during dev/publish aren't available statically (eg: a version string, some identifier for 3p libraries, etc) and reading those values only fromwrangler.toml
isn't good ergonomically. So we can now read those values when passed through the CLI.Example: add a var during dev:
wrangler dev --var xyz:123
will inject the varxyz
with string"123"
(note, only strings allowed for
--var
)substitute a global value:
wrangler dev --define XYZ:123
will replace every global identifierXYZ
with the value123
.The same flags also work with
wrangler publish
.Also, you can use actual environment vars in these commands. e.g.:
wrangler dev --var xyz:$XYZ
will setxyz
to whateverXYZ
has been set to in the terminal environment.
-
#1700
d7c23e49
Thanks @penalosa! - Closes #1505 by extendingwrangler tail
to allow for passing worker routes as well as worker script names.For example, if you have a worker
example-worker
assigned to the routeexample.com/*
, you can retrieve it's logs by running eitherwrangler tail example.com/*
orwrangler tail example-worker
—previously onlywrangler tail example-worker
was supported.
-
#1691
5b2c3ee2
Thanks @cameron-robey! - chore: bump undici and increase minimum node version to 16.13- We bump undici to version to 5.9.1 to patch some security vulnerabilities in previous versions
- This requires bumping the minimum node version to >= 16.8 so we update the minimum to the LTS 16.13
- #1686
a0a3ffde
Thanks @Skye-31! - fix: pages dev correctly escapes regex characters in function paths (fixes #1685)
-
#1628
61e3f00b
Thanks @Skye-31! - fix: pages dev process exit when proxied process exitsCurrently, if the process pages dev is proxying exists or crashes, pages dev does not clean it up, and attempts to continue proxying requests to it, resulting in it throwing 502 errors. This fixes that behaviour to make wrangler exit with the code the child_process exits with.
-
#1710
9943e647
Thanks @rozenmd! - fix: pass create-cloudflare the correct pathwrangler generate was passing create-cloudflare an absolute path, rather than a folder name, resulting in "doubled-up" paths
- #1712
c18c60ee
Thanks @petebacondarwin! - feat: add debug logging to CF API requests and remote dev worker requests
-
#1663
a9f9094c
Thanks @GregBrimble! - feat: Adds--compatibility-date
and--compatibility-flags
towrangler pages dev
Soon to follow in production.
- #1653
46b73b52
Thanks @WalshyDev! - Fixed R2 create bucket API endpoint. Thewrangler r2 bucket create
command should work again
-
#1655
fed80faa
Thanks @jahands! - fix: Pages Functions custom _routes.json not being usedAlso cleaned up when we were reading generated _routes.json
-
#1626
f650a0b2
Thanks @JacobMGEvans! - fix: Added pathname to the constructed URL service bindings + wrangler dev ignores pathname when making a request.resolves #1598
- #1648
af669a19
Thanks @CarmenPopoviciu! - Implement new wrangler pages functions optimize-routes command
- #1622
02bdfde0
Thanks @Skye-31! - fix: Handle static files with multiple extensions, e.g. /a.b should resolve /a.b.html, if /a.b as a file does not exist
-
#1666
662dfdf9
Thanks @jahands! - fix: Consolidate routes that are over the limit to prevent failed deploymentsRather than failing a deployment because a route is too long (>100 characters), it will now be shortened to the next available level. Eg.
/foo/aaaaaaa...
->/foo/*
- #1670
1b232aaf
Thanks @Skye-31! - fix: dev.tsx opens 127.0.0.1 instead of 0.0.0.0 (doesn't work on windows)
-
#1656
37852672
Thanks @jahands! - fix: Warn when Pages Functions have no routesBuilding/publishing pages functions with no valid handlers would result in a Functions script containing no routes, often because the user is using the functions directory for something unrelated. This will no longer add an empty Functions script to the deployment, needlessly consuming Functions quota.
- #1665
c40fca42
Thanks @GregBrimble! - fix: Fix SW and Durable Object request URLs made over the service registry
-
#1645
ac397480
Thanks @JacobMGEvans! - feat: download & initialize a wrangler project from dashboard workerAdded
wrangler init --from-dash <worker-name>
, which allows initializing a wrangler project from a pre-existing worker in the dashboard.Resolves #1624 Discussion: #1623
Notes:
multiplart/form-data
parsing is not currently supported in Undici, so a temporary workaround to slice off top and bottom boundaries is in place.
-
#1639
d86382a5
Thanks @matthewdavidrodgers! - fix: support 'exceededMemory' error status in tailWhile the exception for 'Worker exceeded memory limits' gets logged correctly when tailing, the actual status wasn't being counted as an error, and was falling through a switch case to 'unknown'
This ensures filtering and logging reflects that status correctly
-
#1609
fa8cb73f
Thanks @jahands! - patch: Consolidate redundant routes when generating _routes.generated.jsonExample:
["/foo/:name", "/foo/bar"] => ["/foo/*"]
-
#1595
d4fbd0be
Thanks @caass! - Add support for Alarm Events inwrangler tail
wrangler tail --format pretty
now supports receiving events from Durable Object Alarms, and will display the time the alarm was triggered.Additionally, any future unknown events will simply print "Unknown Event" instead of crashing the
wrangler
process.Closes #1519
-
#1642
a3e654f8
Thanks @jrf0110! - feat: Add output-routes-path to functions buildThis controls the output path of the _routes.json file. Also moves _routes.json generation to tmp directory during functions build + publish
- #1606
24327289
Thanks @Skye-31! - chore: make prettier also fix changesets, as it causes checks to fail if they're not formatted
-
#1611
3df0fe04
Thanks @GregBrimble! - feat: Durable Object multi-worker bindings in local dev.Building on the recent work for multi-worker Service bindings in local dev, this now adds support for direct Durable Object namespace bindings.
A parent (calling) Worker will look for child Workers (where the Durable Object has been defined) by matching the
script_name
configuration option with the child's Service name. For example, if you have a Worker A which defines a Durable Object,MyDurableObject
, and Worker B which references A's Durable Object:name = "A" [durable_objects] bindings = [ { name = "MY_DO", class_name = "MyDurableObject" } ]
name = "B" [durable_objects] bindings = [ { name = "REFERENCED_DO", class_name = "MyDurableObject", script_name = "A" } ]
MY_DO
will work as normal in Worker A.REFERENCED_DO
in Worker B will point at A's Durable Object.Note: this only works in local mode (
wrangler dev --local
) at present.
- #1621
2aa3fe88
Thanks @Skye-31! - fix(#1487) [pages]: Command failed: git rev-parse --abrev-ref HEAD
-
#1602
ebd1d631
Thanks @huw! - fix: PassusageModel
to Miniflare in local devThis allows Miniflare to dynamically update the external subrequest limit for Unbound workers.
-
#1518
85ab8a93
Thanks @jahands! - feature: Reduce Pages Functions executions for Asset-only requests in_routes.json
Manually create a
_routes.json
file in your build output directory to specify routes. This is a set of inclusion/exclusion rules to indicate when to run a Pages project's Functions. Note: This is an experemental feature and is subject to change.
- #1643
4b04a377
Thanks @GregBrimble! - feat: Add--inspector-port
argument towrangler pages dev
-
#1641
5f5466ab
Thanks @GregBrimble! - feat: Add support for using external Durable Objects fromwrangler pages dev
.An external Durable Object can be referenced using
npx wrangler pages dev ./public --do MyDO=MyDurableObject@api
where the Durable Object is made available onenv.MyDO
, and is described in a Workers service (name = "api"
) with the class nameMyDurableObject
.You must have the
api
Workers service running in as anotherwrangler dev
process elsewhere already in order to reference that object.
-
#1605
9e632cdd
Thanks @kimyvgy! - refactor: add --ip argument forwrangler pages dev
& defaults IP to0.0.0.0
Add new argument
--ip
for the commandwrangler pages dev
, defaults to0.0.0.0
. The commandwrangler dev
is also defaulting to0.0.0.0
instead oflocalhost
.
- #1604
9732fafa
Thanks @WalshyDev! - Added R2 support for wrangler pages dev. You can add an R2 binding with--r2 <BINDING>
.
-
#1608
9f02758f
Thanks @jrf0110! - feat: Generate _routes.generated.json for Functions routingWhen using Pages Functions, a _routes.generated.json file is created to inform Pages how to route requests to a project's Functions Worker.
-
#1603
7ae059b3
Thanks @JacobMGEvans! - feat: R2 Object Deletequote Improving the R2 objects management, added the functionality to delete objects in a bucket.resolves #1584
- #1577
359d0ba3
Thanks @threepointone! - chore: update esbuild to 0.14.51
-
#1438
0a9fe918
Thanks @caass! - Initial implementation ofwrangler generate
wrangler generate
andwrangler generate <name>
delegate towrangler init
.wrangler generate <name> <template>
delegates tocreate-cloudflare
Naming behavior is replicated from wrangler 1, and will auto-increment the worker name based on pre-existing directories.
-
#1534
d3ae16cf
Thanks @cameron-robey! - feat: publish full url onwrangler publish
for workers.dev workersWhen the url is printed out on
wrangler publish
, the full url is printed out so that it can be accessed from the terminal easily by doing cmd+click. Implemented only for workers.dev workers.Resolves #1530
- #1576
f696ebb5
Thanks @petebacondarwin! - feat: add platform/os to usage metrics events
- #1576
f696ebb5
Thanks @petebacondarwin! - fix: rename pages metrics events to align better with the dashboard
-
#1550
aca9c3e7
Thanks @cameron-robey! - feat: describe current permissions inwrangler whoami
Often users experience issues due to tokens not having the correct permissions associated with them (often due to new scopes being created for new products). With this, we print out a list of permissions associated with OAuth tokens with the
wrangler whoami
command to help them debug for OAuth tokens. We cannot access the permissions on an API key, so we direct the user to the location in the dashboard to achieve this. We also cache the scopes of OAuth tokens alongside the access and refresh tokens in the .wrangler/config file to achieve this.Currently unable to implement #1371 - instead directs the user to the dashboard. Resolves #1540
-
#1575
5b1f68ee
Thanks @JacobMGEvans! - feat: legacy "kv-namespace" not supported In previous Wrangler 1, there was a legacy configuration that was considered a "bug" and removed. Before it was removed, tutorials, templates, blogs, etc... had utlized that configuration property to handle this in Wrangler 2 we will throw a blocking error that tell the user to utilize "kv_namespaces"resolves #1421
-
#1404
17f5b576
Thanks @threepointone! - feat: add cache control options toconfig.assets
This adds cache control options to
config.assets
. This is already supported by the backing library (@cloudflare/kv-asset-handler
) so we simply pass on the options at its callsite.Additionally, this adds a configuration field to serve an app in "single page app" mode, where a root index.html is served for all html/404 requests (also powered by the same library).
-
#1578
cf552192
Thanks @cameron-robey! - feat: source-map function namesFollowing on from #1535, using new functionality from esbuild v0.14.50 of generation of
names
field in generated sourcemaps, we output the original function name in the stack trace.
-
#1503
ebc1aa57
Thanks @threepointone! - feat: zero config multiworker development (local mode)Preamble: Typically, a Worker has been the unit of a javascript project on our platform. Any logic that you need, you fit into one worker, ~ 1MB of javascript and bindings. If you wanted to deploy a larger application, you could define different workers on different routes. This is fine for microservice style architectures, but not all projects can be cleaved along the route boundaries; you lose out on sharing code and resources, and can still cross the size limit with heavy dependencies.
Service bindings provide a novel mechanism for composing multiple workers into a unified architecture. You could deploy shared code into a worker, and make requests to it from another worker. This lets you architect your code along functional boundaries, while also providing some relief to the 1MB size limit.
I propose a model for developing multiple bound workers in a single project.
Consider Worker A, at
workers/a.js
, with awrangler.toml
like so:name = 'A' [[services]] binding = 'Bee' service = 'B'
and content like so:
export default { fetch(req, env) { return env.Bee.fetch(req); } };
Consider Worker B, at
workers/b.js
, with awrangler.toml
like so:name = 'B'
and content like so:
export default { fetch(req, env) { return new Response("Hello World"); } };
So, a worker A, bound to B, that simply passes on the request to B.
Currently, when I run
wrangler dev --local
on A (or switch from remote to local mode during a dev session), and make requests to A, they'll fail because the bindings don't exist in local mode.What I'd like, is to be able to run
wrangler dev --local
on B as well, and have my dev instance of A make requests to the dev instance of B. When I'm happy with my changes, I'd simply deploy both workers (again, ideally as a batched publish).- Running
wrangler dev
on a machine should start up a local service registry (if there isn't one loaded already) as a server on a well known port. - Further, it should then "register" itself with the registry with metadata about itself; whether it's running in remote/local mode, the port and ip its dev server is listening on, and any additional configuration (eg: in remote mode, a couple of extra headers have to be added to every request made to the dev session, so we'd add that data into the registry as well.)
- Every worker that has service bindings configured, should intercept requests to said binding, and instead make a request to the locally running instance of the service. It could rewrite these requests as it pleases.
(In future PRs, we'll introduce a system for doing the same with remote mode dev, as well as mixed mode. )
- Running
-
#1551
1b54b54f
Thanks @threepointone! - internal: middleware for modifying worker behaviourThis adds an internal mechanism for applying multiple "middleware"/facades on to workers. This lets us add functionality during dev and/or publish, where we can modify requests or env, or other ideas. (See #1466 for actual usecases)
As part of this, I implemented a simple facade that formats errors in dev. To enable it you need to set an environment variable
FORMAT_WRANGLER_ERRORS=true
. This isn't a new feature we're shipping with wrangler, it's simply to demonstrate how to write middleware. We'll probably remove it in the future.
- #1486
c4e6f156
Thanks @JacobMGEvans! - feat: commands added for uploading and downloading objects from r2.
-
#1539
95d0f863
Thanks @threepointone! - fix: export durable objects correctly when using--assets
The facade for static assets doesn't export any exports from the entry point, meaning Durable Objects will fail. This fix adds all exports to the facade's exports.
- #1564
69713c5c
Thanks @JacobMGEvans! - chore: updated wrangler readme providing additional context on configuration, deep link toinit
and fixing old link to beta docs.
-
#1581
3da184f1
Thanks @threepointone! - fix: apply multiworker dev facade only when requiredThis fix makes sure the multiworker dev facade is applied to the input worker only where there are other wrangler dev instances running that are bound to the input worker. We also make sure we don't apply it when we already have a binding (like in remote mode).
-
#1576
f696ebb5
Thanks @petebacondarwin! - feat: add metricsEnabled header to CF API calls when developing or deploying a workerThis allows us to estimate from API requests what proportion of Wrangler instances have enabled usage tracking, without breaking the agreement not to send data for those who have not opted in.
-
#1525
a692ace3
Thanks @threepointone! - feat:config.first_party_worker
+ dev facadeThis introduces configuration for marking a worker as a "first party" worker, to be used inside cloudflare to develop workers. It also adds a facade that's applied for first party workers in dev.
-
#1545
b3424e43
Thanks @Martin-Eriksson! - fix: Throw error if bothdirectory
andcommand
is specified forpages dev
The previous behavior was to silently ignore the
command
argument.
-
#1574
c61006ca
Thanks @jahands! - fix: Retry check-missing call to make wrangler pages publish more reliableBefore uploading files in wrangler pages publish, we make a network call to check what files need to be uploaded. This call could sometimes fail, causing the publish to fail. This change will retry that network call.
-
#1565
2b5a2e9a
Thanks @threepointone! - fix: export durable object bindings when using service bindings in devA similar fix to #1539, this exports correctly when using service bindings in dev.
-
#1510
4dadc414
Thanks @matthewdavidrodgers! - refactor: touch up publishing to custom domainsCouple things cleaned up here:
Originally the usage of the /domains api (for publishing to custom domains) was a bit clumsy: we would attempt to optimistically publish, but the api would eagerly fail with specific error codes on why it occurred. This made for some weird control flow for retries with override flags, as well as fragile extraction of error messages.
Now we use the new /domains/changeset api to generate a changeset of actions required to get to a new state of custom domains, which informs us up front of which domains would need to be updated and overridden, and we can pass flags as needed. I do make an extra hop back to the api to lookup what the custom domains requiring updates are already attached to, but given how helpful I imagine that to be, I'm for it.
I also updated the api used for publishing the domains, from /domains to /domains/records. The latter was added to allow us to add flexibility for things like the /domains/changeset resource, and thus the former is being deprecated
- #1576
f696ebb5
Thanks @petebacondarwin! - feat: send whether a Worker is using TypeScript or not in usage events
-
#1535
eee7333b
Thanks @cameron-robey! - feat: source maps support inwrangler dev
remote modePreviously stack traces from runtime errors in
wrangler dev
remote mode, would give unhelpful stack traces from the bundled build that was sent to the server. Here, we use source maps generated as part of bundling to provide better stack traces for errors, referencing the unbundled files.Resolves #1509
-
#1500
0826f833
Thanks @cameron-robey! - fix: warn when using--no-bundle
with--minify
or--node-compat
Fixes #1491
-
#1523
e1e2ee5c
Thanks @threepointone! - fix: don't log version spam in testsCurrently in tests, we see a bunch of logspam from yargs about "version" being a reserved word, this patch removes that spam.
-
#1498
fe3fbd95
Thanks @cameron-robey! - feat: change version command to give update information When running version command, we want to display update information if current version is not up to date. Achieved by replacing default output with the wrangler banner. Previous behaviour (just outputting current version) reamins when !isTTY. Version command changed from inbuilt .version() from yargs, to a regular command to allow for asynchronous behaviour.Implements #1492
-
#1431
a2e3a6b7
Thanks @Skye-31! - chore: Refactorwrangler pages dev
to use Wrangler-proper's own dev server.This:
- fixes some bugs (e.g. not proxying WebSockets correctly),
- presents a much nicer UI (with the slick keybinding controls),
- adds features that
pages dev
was missing (e.g.--local-protocol
), - and reduces the maintenance burden of
wrangler pages dev
going forward.
-
#1528
60bdc31a
Thanks @threepointone! - fix: prevent local mode restartIn dev, we inject a patch for
fetch()
to detect bad usages. This patch is copied into the destination directory before it's used. esbuild appears to have a bug where it thinks a dependency has changed so it restarts once in local mode. The fix here is to copy the file to inject into a separate temporary dir.Fixes #1515
-
#1502
be4ffde5
Thanks @threepointone! - polish: recommend using an account id when user details aren't available.When using an api token, sometimes the call to get a user's membership details fails with a 9109 error. In this scenario, a workaround to skip the membership check is to provide an account_id in wrangler.toml or via CLOUDFLARE_ACCOUNT_ID. This bit of polish adds this helpful tip into the error message.
- #1499
7098b1ee
Thanks @cameron-robey! - fix: no feedback onwrangler kv:namespace delete
-
#1479
862f14e5
Thanks @threepointone! - fix: readprocess.env.NODE_ENV
correctly when building workerWe replace
process.env.NODE_ENV
in workers with the value of the environment variable. However, we have a bug where when we make an actual build of wrangler (which has NODE_ENV set as "production"), we were also replacing the expression where we'd replace it in a worker. The result was that all workers would haveprocess.env.NODE_ENV
set to production, no matter what the user had set. The fix here is to use a "dynamic" value for the expression so that our build system doesn't replace it.Fixes #1477
- #1471
0953af8e
Thanks @JacobMGEvans! - ci: implement CodeCov Integration CodeCov is used for analyzing code and tests to improve stability and maintainability. It does this by utilizing static code analysis and testing output to provide insights into things that need improving, security concerns, missing test coverage of critical code, and more, which can be missed even after exhaustive human review.
-
#1516
e178d6fb
Thanks @threepointone! - polish: don't log an error message if wrangler dev startup is interrupted.When we quit wrangler dev, any inflight requests are cancelled. Any error handlers for those requests are ignored if the request was cancelled purposely. The check for this was missing for the prewarm request for a dev session, and this patch adds it so it dorsn't get logged to the terminal.
-
#1496
8eb91142
Thanks @threepointone! - fix: addfetch()
dev helper correctly for pnp style package managersIn #992, we added a dev-only helper that would warn when using
fetch()
in a manner that wouldn't work as expected (because of a bug we currently have in the runtime). We did this by injecting a file that would override usages offetch()
. When using pnp style package managers like yarn, this file can't be resolved correctly. So to fix that, we extract it into the temporary destination directory that we use to build the worker (much like a similar fix we did in #1154)Reported at #1320 (comment)
-
#1529
1a0ac8d0
Thanks @GregBrimble! - feat: Adds the--experimental-enable-local-persistence
option towrangler pages dev
Previously, this was implicitly enabled and stored things in a
.mf
directory. Now we move to be in line with whatwrangler dev
does, defaults disabled, and stores in awrangler-local-state
directory.
-
#1514
9271680d
Thanks @threepointone! - feat: addconfig.inspector_port
This adds a configuration option for the inspector port used by the debugger in
wrangler dev
. This also includes a bug fix where we weren't passing on this configuration to local mode.
-
#1482
9eb28ec
Thanks @petebacondarwin! - fix: do not ask the user for metrics permission if running in a CIFixes #1480
-
#1482
9eb28ec
Thanks @petebacondarwin! - feat: support controlling metrics gathering viaWRANGLER_SEND_METRICS
environment variableSetting the
WRANGLER_SEND_METRICS
environment variable will override any other metrics controls, such as thesend_metrics
property in wrangler.toml and cached user preference.
-
#1474
f602df7
Thanks @threepointone! - fix: enable debugger in local modeDuring a refactor, we missed enabling the inspector by default in local mode. We also broke the logic that detects the inspector url exposed by the local server. This patch passes the argument correctly, fixes the detection logic. Further, it also lets you disable the inspector altogether with
--inspect false
, if required (for both remote and local mode).Fixes #1436
-
#1470
01f49f1
Thanks @petebacondarwin! - fix: ensure that metrics user interactions do not break other UIThe new metrics usage capture may interact with the user if they have not yet set their metrics permission. Sending metrics was being done concurrently with other commands, so there was a chance that the metrics UI broke the other command's UI. Now we ensure that metrics UI will happen synchronously.
-
#1464
0059d84
Thanks @petebacondarwin! - ci: ensure that the SPARROW_SOURCE_KEY is included in release buildsPreviously, we were including the key in the "build" step of the release job. But this is only there to check that the build doesn't fail. The build is re-run inside the publish step, which is part of the "changeset" step. Now, we include the key in the "changeset" step to ensure it is there in the build that is published.
-
#1410
52fb634
Thanks @petebacondarwin! - feat: add opt-in usage metrics gatheringThis change adds support in Wrangler for sending usage metrics to Cloudflare. This is an opt-in only feature. We will ask the user for permission only once per device. The user must grant permission, on a per device basis, before we send usage metrics to Cloudflare. The permission can also be overridden on a per project basis by setting
send_metrics = false
in thewrangler.toml
. If Wrangler is running in non-interactive mode (such as in a CI job) and the user has not already given permission we will assume that we cannot send usage metrics.The aim of this feature is to help us learn what and how features of Wrangler (and also the Cloudflare dashboard) are being used in order to improve the developer experience.
-
#1463
a7ae733
Thanks @threepointone! - fix: ensure that a helpful error message is shown when on unsupported versions of node.jsOur entrypoint for wrangler (
bin/wrangler.js
) needs to run in older versions of node and log a message to the user that they need to upgrade their version of node. Sometimes we use syntax in this entrypoint that doesn't run in older versions of node. crashing the script and failing to log the message. This fix adds a test in CI to make sure we don't regress on that behaviour (as well as fixing the current newer syntax usage)Fixes #1443
-
#1459
4e425c6
Thanks @sidharthachatterjee! - fix:wrangler pages publish
now more reliably retries an upload in case of a failureWhen
wrangler pages publish
is run, we make calls to an upload endpoint which could be rate limited and therefore fail. We currently retry those calls after a linear backoff. This change makes that backoff exponential which should reduce the likelihood of subsequent calls being rate limited.
- #1451
62649097
Thanks @WalshyDev! - Fixed an issue where Pages upload would OOM. This was caused by us loading all the file content into memory instead of only when required.
-
#1375
e9e98721
Thanks @JacobMGEvans! - polish: Compliance with the XDG Base Directory Specification Wrangler was creating a config file in the home directory of the operating system~/.wrangler
. The XDG path spec is a standard for storing files, these changes include XDG pathing compliance for.wrangler/*
location and backwards compatibility with previous~/.wrangler
locations.resolves #1053
- #1449
ee6c421b
Thanks @alankemp! - Output additional information about uploaded scripts at WRANGLER_LOG=log level
-
#1389
eab9542
Thanks @caass! - Remove delegation message when global wrangler delegates to a local installationA message used for debugging purposes was accidentally left in, and confused some folks. Now it'll only appear when
WRANGLER_LOG
is set todebug
.
-
#1447
16f9436
Thanks @threepointone! - feat: r2 support inwrangler dev --local
This adds support for r2 bindings in
wrangler dev --local
, powered by miniflare@2.6.0 via cloudflare/miniflare#289.Fixes #1066
-
#1406
0f35556
Thanks @rozenmd! - fix: use fork to let wrangler know miniflare is readyThis PR replaces our use of
spawn
in favour offork
to spawn miniflare in wrangler's dev function. This lets miniflare let wrangler know when we're ready to send requests.Closes #1408
-
#999
238b546
Thanks @caass! - Include devtools in wrangler monorepoPreviously, wrangler relied on @threepointone's built-devtools. Now, these devtools are included in the wrangler repository.
-
#1424
8cf0008
Thanks @caass! - fix: Checkconfig.assets
when deciding whether to include a default entry point.An entry point isn't mandatory when using
--assets
, and we can use a default worker when doing so. This fix enables that same behaviour whenconfig.assets
is configured.
-
#1448
0d462c0
Thanks @threepointone! - polish: setcheckjs: false
andjsx: "react"
in newly created projectsWhen we create a new project, it's annoying having to set jsx: "react" when that's the overwhelmingly default choice, our compiler is setup to do it automatically, and the tsc error message isn't helpful. So we set
jsx: "react"
in the generated tsconfig.Setting
checkJs: true
is also annoying because it's not a common choice. So we setcheckJs: false
in the generated tsconfig.
-
#1450
172310d
Thanks @threepointone! - polish: tweak static assets facade to log only real errorsThis prevents the abundance of NotFoundErrors being unnecessaryily logged.
-
#1415
f3a8452
Thanks @caass! - Emit type declarations for wranglerThis is a first go-round of emitting type declarations alongside the bundled JS output, which should make it easier to use wrangler as a library.
-
#1433
1c1214f
Thanks @threepointone! - polish: adds an actionable message when a worker name isn't provided to tail/secretJust a better error message when a Worker name isn't available for
wrangler secret
orwrangler tail
.Closes #1380
-
#1427
3fa5041
Thanks @caass! - Checknpm_config_user_agent
to guess a user's package managerThe environment variable
npm_config_user_agent
can be used to guess the package manager that was used to execute wrangler. It's imperfect (just like regular user agent sniffing!) but the package managers we support all set this property:
-
#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 #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 thedev
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 #1310.
-
#1403
9c6c3fb
Thanks @threepointone! - feat:config.no_bundle
as a configuration option to prevent bundlingAs a configuration parallel to
--no-bundle
(introduced in #1300 as--no-build
, renamed in #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 #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 #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 #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 #1333
-
#1350
dee034b
Thanks @rozenmd! - feat: export an (unstable) function that folks can use in their own scripts to invoke wrangler's dev CLICloses #1350
-
#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 #1370
-
#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):
describe("worker", async () => { const worker = await wrangler.unstable_dev("src/index.ts"); const resp = await worker.fetch(); expect(resp).not.toBe(undefined); if (resp) { const text = await resp.text(); expect(text).toMatchInlineSnapshot(`"Hello World!"`); } worker.stop(); }
Closes #1383 Closes #1384 Closes #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 #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 #1324
-
#1309
e5a6aca
Thanks @petebacondarwin! - style: convert all source code indentation to tabsFixes #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 #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 #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 #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
-
#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 #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 add[[worker_namespaces]] binding = 'dispatcher' # available as env.dispatcher in your worker namespace = 'namespace-name' # the name of the namespace being bound
Based on work by @aaronlisman in #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 #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 forroute = ""
. To keep parity it will be possible to setroute = ""
in the config file and represent not setting a route, while providing a warning.resolves #1329
4ad084e
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
-
#1272
f7d362e
Thanks @JacobMGEvans! - feat: print bundle size duringpublish
anddev
This logs the complete bundle size of the Worker (as well as when compressed) during
publish
anddev
.Via #405 (comment))
-
#1287
2072e27
Thanks @f5io! - fix: kv:key put/get binary fileAs raised in #1254, it was discovered that binary uploads were being mangled by wrangler 2, whereas they worked in wrangler 1. This is because they were read into a string by providing an explicit encoding of
utf-8
. This fix reads provided files into a nodeBuffer
that is then passed directly to the request.Subsequently #1273 was raised in relation to a similar issue with gets from wrangler 2. This was happening due to the downloaded file being converted to
utf-8
encoding as it was pushed throughconsole.log
. By leveragingprocess.stdout.write
we can push the fetchedArrayBuffer
to std out directly without inferring any specific encoding value.
- #1325
bcd066d
Thanks @sidharthachatterjee! - fix: Ensure Response is mutable in Pages functions
-
#1265
e322475
Thanks @petebacondarwin! - fix: support all git versions forwrangler init
If
git
does not support the--initial-branch
argument then just fallback to the default initial branch name.We tried to be more clever about this but there are two many weird corner cases with different git versions on different architectures. Now we do our best, with recent versions of git, to ensure that the branch is called
main
but otherwise just make sure we don't crash.Fixes #1228
-
#1311
374655d
Thanks @JacobMGEvans! - feat: add--text
flag to decodekv:key get
response values as utf8 stringsPreviously, all kv values were being rendered directly as bytes to the stdout, which makes sense if the value is a binary blob that you are going to pipe into a file, but doesn't make sense if the value is a simple string.
resolves #1306
-
#1327
4880d54
Thanks @JacobMGEvans! - feat: resolve--site
cli arg relative to current working directoryBefore we were resolving the Site directory relative to the location of
wrangler.toml
at all times. Now the--site
cli arg is resolved relative to current working directory.resolves #1243
-
#1270
7ed5e1a
Thanks @caass! - Delegate to a local install ofwrangler
if one exists.Users will frequently install
wrangler
globally to run commands likewrangler init
, but we also recommend pinning a specific version ofwrangler
in a project'spackage.json
. Now, when a user invokes a global install ofwrangler
, we'll check to see if they also have a local installation. If they do, we'll delegate to that version.
-
#1289
0d6098c
Thanks @threepointone! - feat: entry point is not mandatory if--assets
is passedSince we use a facade worker with
--assets
, an entry point is not strictly necessary. This makes a common usecase of "deploy a bunch of static assets" extremely easy to start, as a one linernpx wrangler dev --assets path/to/folder
(and same withpublish
).
-
#1293
ee57d77
Thanks @petebacondarwin! - fix: do not crash inwrangler dev
if user has multiple accountsWhen a user has multiple accounts we show a prompt to allow the user to select which they should use. This was broken in
wrangler dev
as we were trying to start a new ink.js app (to show the prompt) from inside a running ink.js app (the UI forwrangler dev
).This fix refactors the
ChooseAccount
component so that it can be used directly within another component.Fixes #1258
- #1299
0fd0c30
Thanks @threepointone! - polish: include a copy-pastable message when trying to publish without a compatibility date
-
#1269
fea87cf
Thanks @petebacondarwin! - fix: do not consider ancestor files when initializing a project with a specified nameWhen initializing a new project (via
wrangler init
) we attempt to reuse files in the current directory, or in an ancestor directory. In particular we look up the directory tree for package.json and tsconfig.json and use those instead of creating new ones.Now we only do this if you do not specify a name for the new Worker. If you do specify a name, we now only consider files in the directory where the Worker will be initialized.
Fixes #859
-
#1321
8e2b92f
Thanks @GregBrimble! - fix: Correctly resolve directories for 'wrangler pages publish'Previously, attempting to publish a nested directory or the current directory would result in parsing mangled paths which broke deployments. This has now been fixed.
-
#1293
ee57d77
Thanks @petebacondarwin! - fix: do not hang waiting for account choice when in non-interactive modeThe previous tests for non-interactive only checked the stdin.isTTY, but you can have scenarios where the stdin is interactive but the stdout is not. For example when writing the output of a
kv:key get
command to a file.We now check that both stdin and stdout are interactive before trying to interact with the user.
-
#1294
f6836b0
Thanks @threepointone! - fix: serve--assets
in dev + local modeA quick bugfix to make sure --assets/config.assets gets served correctly in
dev --local
.
-
#1237
e1b8ac4
Thanks @threepointone! - feat:--assets
/config.assets
to serve a folder of static assetsThis adds support for defining
assets
inwrangler.toml
. You can configure it with a string path, or a{bucket, include, exclude}
object (much like[site]
). This also renames the--experimental-public
arg as--assets
.Via #1162
-
a4ba42a
Thanks @threepointone! - Revert "Take 2 at moving .npmrc to the root of the repository (#1281)" -
#1267
c667398
Thanks @rozenmd! - fix: let folks know the URL we're opening during loginCloses #1259
- #1260
d8ee04f
Thanks @threepointone! - fix: pass env and ctx to request handler when using--experimental-public
1b068c9
Thanks @threepointone! - Revert "fix: kv:key put upload binary files fix (#1255)"
-
#1229
e273e09
Thanks @timabb031! - fix: parsing of node inspector urlThis fixes the parsing of the url returned by Node Inspector via stderr which could be received partially in multiple chunks or in a single chunk.
Closes #1226
-
#1255
2d806dc
Thanks @f5io! - fix: kv:key put binary file uploadAs raised in #1254, it was discovered that binary uploads were being mangled by wrangler 2, whereas they worked in wrangler 1. This is because they were read into a string by providing an explicit encoding of
utf-8
. This fix reads provided files into a nodeBuffer
that is then passed directly to the request.
-
#1248
db8a0bb
Thanks @threepointone! - fix: instruct api to exclude script content on worker uploadWhen we upload a script bundle, we get the actual content of the script back in the response. Sometimes that script can be large (depending on whether the upload was large), and currently it may even be a badly escaped string. We can pass a queryparam
excludeScript
that, as it implies, exclude the script content in the response. This fix does that.Fixes #1222
-
#1253
eee5c78
Thanks @threepointone! - fix: resolve asset handler for--experimental-path
In #1241, we removed the vendored version of
@cloudflare/kv-asset-handler
, as well as the build configuration that would point to the vendored version when compiling a worker using--experimental-public
. However, wrangler can be used where it's not installed in thepackage.json
for the worker, or even when there's no package.json at all (like when wrangler is installed globally, or used withnpx
). In this situation, if the user doesn't have@cloudflare/kv-asset-handler
installed, then building the worker will fail. We don't want to make the user install this themselves, so instead we point to a barrel import for the library in the facade for the worker.
-
#1234
3e94bc6
Thanks @threepointone! - feat: support--experimental-public
in local mode--experimental-public
is an abstraction over Workers Sites, and we can leverage miniflare's inbuilt support for Sites to serve assets in local mode.
-
#1236
891d128
Thanks @threepointone! - fix: generate site assets manifest relative tosite.bucket
We had a bug where we were generating asset manifest keys incorrectly if we ran wrangler from a different path to
wrangler.toml
. This fixes the generation of said keys, and adds a test for it.Fixes #1235
-
#1216
4eb70f9
Thanks @JacobMGEvans! - feat: reload server on configuration changes, the values passed into the server during restart will bebindings
resolves #439
-
#1231
5206c24
Thanks @threepointone! - feat:build.watch_dir
can be an array of pathsIn projects where:
- all the source code isn't in one folder (like a monorepo, or even where the worker has non-standard imports across folders),
- we use a custom build, so it's hard to statically determine folders to watch for changes
...we'd like to be able to specify multiple paths for custom builds, (the config
build.watch_dir
config). This patch enables such behaviour. It now accepts a single path as before, or optionally an array of strings/paths.Fixes #1095
-
#1241
471cfef
Thanks @threepointone! - use@cloudflare/kv-asset-handler
for--experimental-public
We'd previously vendored in
@cloudflare/kv-asset-handler
andmime
for--experimental-public
. We've since updated@cloudflare/kv-asset-handler
to support module workers correctly, and don't need the vendored versions anymore. This patch uses the lib as a dependency, and deletes thevendor
folder.
-
#1239
df55709
Thanks @threepointone! - polish: don't include folder name in Sites kv asset keysAs reported in #1189, we're including the name of the folder in the keys of the KV store that stores the assets. This doesn't match v1 behaviour. It makes sense not to include these since, we should be able to move around the folder and not have to reupload the entire folder again.
Fixes #1189
-
#1210
785d418
Thanks @GregBrimble! - feat: Upload the delta forwrangler pages publish
We now keep track of the files that make up each deployment and intelligently only upload the files that we haven't seen. This means that similar subsequent deployments should only need to upload a minority of files and this will hopefully make uploads even faster.
-
#1195
66a85ca
Thanks @threepointone! - fix: batch sites uploads in groups under 100mbThere's an upper limit on the size of an upload to the bulk kv put api (as specified in https://api.cloudflare.com/#workers-kv-namespace-write-multiple-key-value-pairs). This patch batches sites uploads staying under the 100mb limit.
Fixes #1187
-
#1218
f8a21ed
Thanks @threepointone! - fix: warn on unexpected fields onconfig.triggers
This adds a warning when we find unexpected fields on the
triggers
config (and any future fields that use theisObjectWith()
validation helper)
-
#1192
bafa5ac
Thanks @threepointone! - fix: use worker name as a script ID when generating a preview sessionWhen generating a preview session on the edge with
wrangler dev
, for a zoned worker we were using a random id as the script ID. This would make the backend not associate the dev session with any resources that were otherwise assigned to the script (specifically for secrets, but other stuff as well) The fix is simply to use the worker name (when available) as the script ID.
-
#1212
101342e
Thanks @petebacondarwin! - fix: do not crash when not logged in and switching to remote dev modePreviously, if you are not logged in when running
wrangler dev
it will only try to log you in if you start in "remote" mode. In "local" mode there is no need to be logged in, so it doesn't bother to try to login, and then will crash if you switch to "remote" mode interactively.The problem was that we were only attempting to login once before creating the
<Remote>
component. Now this logic has been moved into auseEffect()
inside<Remote>
so that it will be run whether starting in "remote" or transitioning to "remote" from "local".The fact that the check is no longer done before creating the components is proven by removing the
mockAccountId()
andmockApiToken()
calls from thedev.test.ts
files.Fixes #18
-
#1188
b44cc26
Thanks @petebacondarwin! - fix: fallback on old zone-based API when account-based route API failsWhile we wait for changes to the CF API to support API tokens that do not have "All Zone" permissions, this change provides a workaround for most scenarios.
If the bulk-route request fails with an authorization error, then we fallback to the Wrangler 1 approach, which sends individual route updates via a zone-based endpoint.
Fixes #651
- #1199
e64812e
Thanks @sidharthachatterjee! - fix: Refresh JWT in wrangler pages publish when it expires
-
#1209
2d42882
Thanks @petebacondarwin! - fix: ensure wrangler init works with older versions of gitRather than using the recently added
--initial-branch
option, we now just renamed the initial branch usinggit branch -m main
.Fixes #1168
-
#1184
4a10176
Thanks @timabb031! - polish: add cron trigger to wrangler.toml when new Scheduled Worker is createdWhen
wrangler init
is used to create a new Scheduled Worker a cron trigger (1 * * * *) will be added to wrangler.toml, but only if wrangler.toml is being created during init. If wrangler.toml exists prior to runningwrangler init
then wrangler.toml will remain unchanged even if the user selects the "Scheduled Handler" option. This is as per existing tests in init.test.ts that ensure wrangler.toml is never overwritten after agreeing to prompts. That can change if it needs to.
-
#1163
52c0bf0
Thanks @threepointone! - fix: only log available bindings once indev
Because we were calling
printBindings
during the render phase of<Dev/>
, we were logging the bindings multiple times (render can be called multiple times, and the interaction of Ink's stdout output intermingled with console is a bit weird). We could have put it into an effect, but I think a better solution here is to simply log it before we even start rendering<Dev/>
(so we could see the bindings even if Dev fails to load, for example).This also adds a fix that masks any overriden values so that we don't accidentally log potential secrets into the terminal.
-
#1153
40f20b2
Thanks @petebacondarwin! - fix:minify
andnode_compat
should be inheritedFixes #1150
- #1157
ea8f8d7
Thanks @sidharthachatterjee! - fix: Ignore .git when publishing a Pages project
-
#1171
de4e3c2
Thanks @petebacondarwin! - fix: link to the issue chooser in GitHubPreviously, when an error occurs, wrangler says:
If you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.
Now, it links through to the issue template chooser which is more helpful.
Fixes #1169
-
#1154
5d6de58
Thanks @threepointone! - fix: extract Cloudflare_CA.pem to temp dir before using itWith package managers like yarn, the cloudflare cert won't be available on the filesystem as expected (since the module is inside a .zip file). This fix instead extracts the file out of the module, copies it to a temporary directory, and directs node to use that as the cert instead, preventing warnings like #1136.
Fixes #1136
-
#1166
08e3a49
Thanks @threepointone! - fix: warn on unexpected fields on migrationsThis adds a warning for unexpected fields on
[migrations]
config, reported in #1165. It also adds a test for incorrectrenamed_classes
in a migration.
- #1006
ee0c380
Thanks @danbulant! - feat: add pnpm support
6187f36
Thanks @petebacondarwin! - fix: backslash on manifest keys in windows
- #1158
e452a35
Thanks @sidharthachatterjee! - fix: Skip cfFetch if there are no functions during pages dev
-
#1122
c2d2f44
Thanks @petebacondarwin! - fix: display chained errors from the CF APIFor example if you have an invalid CF_API_TOKEN and try running
wrangler whoami
you now get the additional6111
error information:✘ [ERROR] A request to the Cloudflare API (/user) failed. Invalid request headers [code: 6003] - Invalid format for Authorization header [code: 6111]
- #1161
cec0657
Thanks @petebacondarwin! - refactor: add User-Agent to all CF API requests
-
#1152
b817136
Thanks @threepointone! - polish: Give a copy-paste config when[migrations]
are missingThis gives a slightly better message when migrations are missing for declared durable objcts. Specifically, it gives a copy-pastable section to add to wrangler.toml, and doesn't show the warning at all for invalid class names anymore.
Partially makes #1076 better.
-
#1141
a8c509a
Thanks @rozenmd! - fix: rename "publish" package.json script to "deploy"Renaming the default "publish" package.json script to "deploy" to avoid confusion with npm's publish command.
Closes #1121
-
#1175
e978986
Thanks @timabb031! - feature: allow user to select a handler template withwrangler init
This allows the user to choose which template they'd like to use when they are prompted to create a new worker. The options are currently "None"/"Fetch Handler"/"Scheduled Handler". Support for new handler types such as
email
can be added easily in future.
- #1122
c2d2f44
Thanks @petebacondarwin! - fix: improve error message when CF API responds with an error
- #1110
515a52f
Thanks @rozenmd! - fix: print instructions even if installPackages fails to fetch npm packages
-
#1051
7e2e97b
Thanks @rozenmd! - feat: add support for using wrangler behind a proxyConfigures the undici library (the library wrangler uses for
fetch
) to send all requests via a proxy selected from the first non-empty environment variable from "https_proxy", "HTTPS_PROXY", "http_proxy" and "HTTP_PROXY".
-
#1089
de59ee7
Thanks @rozenmd! - fix: batch package manager installs so folks only have to wait onceWhen running
wrangler init
, we install packages as folks confirm their options. This disrupts the "flow", particularly on slower internet connections.To avoid this disruption, we now only install packages once we're done asking questions.
Closes #1036
-
#1073
6bb2564
Thanks @caass! - Add a better message when a user doesn't have a Chromium-based browser.Certain functionality we use in wrangler depends on a Chromium-based browser. Previously, we would throw a somewhat arcane error that was hard (or impossible) to understand without knowing what we needed. While ideally all of our functionality would work across all major browsers, as a stopgap measure we can at least inform the user what the actual issue is.
Additionally, add support for Brave as a Chromium-based browser.
-
#1079
fb0dec4
Thanks @caass! - Print the bindings a worker has access to duringdev
andpublish
It can be helpful for a user to know exactly what resources a worker will have access to and where they can access them, so we now log the bindings available to a worker during
wrangler dev
andwrangler publish
.
-
#1097
c73a3c4
Thanks @petebacondarwin! - fix: ensure all line endings are normalized before parsing as TOMLOnly the last line-ending was being normalized not all of them.
Fixes #1094
-
#1111
1eaefeb
Thanks @JacobMGEvans! - Git defaultmain
branchpolish: Default branch when choosing to initialize a git repository will now be
main
. This is inline with current common industry ethical practices. See:
-
#1058
1a59efe
Thanks @threepointone! - refactor: detect missing[migrations]
during config validationThis does a small refactor -
- During publish, we were checking whether
[migrations]
were defined in the presence of[durable_objects]
, and warning if not. This moves it into the config validation step, which means it'll check for all commands (but notablydev
) - It moves the code to determine current migration tag/migrations to upload into a helper. We'll be reusing this soon when we upload migrations to
dev
.
- During publish, we were checking whether
-
#1090
85fbfe8
Thanks @petebacondarwin! - refactor: remove use ofany
This "quick-win" refactors some of the code to avoid the use of
any
where possible. Usingany
can cause type-checking to be disabled across the code in unexpectedly wide-impact ways.There is one other use of
any
not touched here because it is fixed by #1088 separately.
-
#1088
d63d790
Thanks @petebacondarwin! - fix: ensure that the proxy server shuts down to preventwrangler dev
from hangingWhen running
wrangler dev
we create a proxy to the actual remote Worker. After creating a connection to this proxy by a browser request the proxy did not shutdown. Now we use aHttpTerminator
helper library to force the proxy to close open connections and shutdown correctly.Fixes #958
-
#1099
175737f
Thanks @petebacondarwin! - fix: delegatewrangler build
towrangler publish
Since
wrangler publish --dry-run --outdir=dist
is basically the same result as what Wrangler 1 did withwrangler build
let's run that for the user if they try to runwrangler build
.
- #1081
8070763
Thanks @rozenmd! - fix: friendlier error for when a subdomain hasn't been configured in dev mode
- #1123
15e5c12
Thanks @timabb031! - chore: updated new worker ts template with env/ctx parameters and added Env interface
-
#1080
4a09c1b
Thanks @caass! - Improve messaging when bulk deleting or uploading KV PairsCloses #555
-
#1000
5a8e8d5
Thanks @JacobMGEvans! -pages dev <dir>
&wrangler pages functions build
will have a--node-compat
flag powered by @esbuild-plugins/node-globals-polyfill (which in itself is powered by rollup-plugin-node-polyfills). The only difference inpages
will be it does not check thewrangler.toml
so thenode_compat = true
will not enable it forwrangler pages
functionality.resolves #890
-
#1028
b7a9ce6
Thanks @GregBrimble! - feat: Use new bulk upload API for 'wrangler pages publish'This raises the file limit back up to 20k for a deployment.
-
#1018
cd2c42f
Thanks @threepointone! - fix: strip leading*
/*.
from routes when deducing a host fordev
When given routes, we use the host name from the route to deduce a zone id to pass along with the host to set with dev
session
. Route patterns can include leading*
/*.
, which we don't account for when deducing said zone id, resulting in subtle errors for the session. This fix strips those leading characters as appropriate.Fixes #1002
-
#1044
7a191a2
Thanks @JacobMGEvans! - fix: trim trailing whitespace from the secrets before uploadingresolves #993
-
#1052
233eef2
Thanks @petebacondarwin! - fix: display the correct help information when a subcommand is invalidPreviously, when an invalid subcommand was used, such as
wrangler r2 foo
, the help that was displayed showed the top-level commands prefixed by the command in used. E.g.wrangler r2 init [name] 📥 Create a wrangler.toml configuration file wrangler r2 dev [script] 👂 Start a local server for developing your worker wrangler r2 publish [script] 🆙 Publish your Worker to Cloudflare. ...
Now the correct command help is displayed:
$ wrangler r2 foo ✘ [ERROR] Unknown argument: foo
wrangler r2
📦 Interact with an R2 store
Commands: wrangler r2 bucket Manage R2 buckets
Flags: -c, --config Path to .toml configuration file [string] -h, --help Show help [boolean] -v, --version Show version number [boolean]
Fixes #871
* [#906](https://github.com/cloudflare/wrangler2/pull/906) [`3279f10`](https://github.com/cloudflare/wrangler2/commit/3279f103fb3b1c27addb4c69c30ad970ab0d5f77) Thanks [@threepointone](https://github.com/threepointone)! - feat: implement support for service bindings
This adds experimental support for service bindings, aka worker-to-worker bindings. It's lets you "call" a worker from another worker, without incurring any network cost, and (ideally) with much less latency. To use it, define a `[services]` field in `wrangler.toml`, which is a map of bindings to worker names (and environment). Let's say you already have a worker named "my-worker" deployed. In another worker's configuration, you can create a service binding to it like so:
```toml
[[services]]
binding = "MYWORKER"
service = "my-worker"
environment = "production" # optional, defaults to the worker's `default_environment` for now
And in your worker, you can call it like so:
export default {
fetch(req, env, ctx) {
return env.MYWORKER.fetch(new Request("http://domain/some-path"));
}
};
Fixes #1026
-
#1045
8eeef9a
Thanks @jrf0110! - fix: Incorrect extension extraction from file paths.Our extension extraction logic was taking into account folder names, which can include periods. The logic would incorrectly identify a file path of .well-known/foo as having the extension of well-known/foo when in reality it should be an empty string.
-
#1039
95852c3
Thanks @threepointone! - fix: don't fetch migrations when in--dry-run
modeFixes #1038
-
#1033
ffce3e3
Thanks @petebacondarwin! - fix:wrangler init
should not crash if Git is not available on WindowsWe check for the presence of Git by trying to run
git --version
. On non-Windows we get an Error withcode
set to "ENOENT". One Windows we get a different error:{ "shortMessage":"Command failed with exit code 1: git --version", "command":"git --version", "escapedCommand":"git --version", "exitCode":1, "stdout":"", "stderr":"'git' is not recognized as an internal or external command,\r\noperable program or batch file.", "failed":true, "timedOut":false, "isCanceled":false, "killed":false }
Since we don't really care what the error is, now we just assume that Git is not available if an error is thrown.
Fixes #1022
-
#982
6791703
Thanks @matthewdavidrodgers! - feature: add support for publishing to Custom DomainsWith the release of Custom Domains for workers, users can publish directly to a custom domain on a route, rather than creating a dummy DNS record first and manually pointing the worker over - this adds the same support to wrangler.
Users declare routes as normal, but to indicate that a route should be treated as a custom domain, a user simply uses the object format in the toml file, but with a new key: custom_domain (i.e.
routes = [{ pattern = "api.example.com", custom_domain = true }]
)When wrangler sees a route like this, it peels them off from the rest of the routes and publishes them separately, using the /domains api. This api is very defensive, erroring eagerly if there are conflicts in existing Custom Domains or managed DNS records. In the case of conflicts, wrangler prompts for confirmation, and then retries with parameters to indicate overriding is allowed.
-
#1019
5816eba
Thanks @threepointone! - feat: bind a durable object by environmentFor durable objects, instead of just
{ name, class_name, script_name}
, this lets you bind by environment as well, like so{ name, class_name, script_name, environment }
.Fixes #996
-
#1057
608dcd9
Thanks @petebacondarwin! - fix: pages "command" can consist of multiple wordsOn Windows, the following command
wrangler pages dev -- foo bar
would error saying thatbar
was not a known argument. This is becausefoo
andbar
are passed to Yargs as separate arguments.A workaround is to put the command in quotes:
wrangler pages dev -- "foo bar"
. But this fix makes thecommand
argument variadic, which also solves the problem.Fixes #965
- #1027
3545e41
Thanks @rozenmd! - feat: trying to use node builtins should recommend you enable node_compat in wrangler.toml
-
#1024
110f340
Thanks @threepointone! - polish: validate payload forkv:bulk put
on client sideThis adds client side validation for the paylod for
kv:bulk put
, importantly ensuring we're uploading only string key/value pairs (as well as validation for the other fields).Fixes #571
556e6dd
Thanks @threepointone! - chore: bump to do a release
-
#987
bb94038
Thanks @threepointone! - fix: encode key when callingkv:ket get
, don't encode when deleting a namespaceThis cleans up some logic from #964.
- we shouldn't be encoding the id when deleting a namespace, since that'll already be an alphanumeric id
- we should be encoding the key when we call kv:key get, or we get a similar issue as in #961
- adds
KV
to all the KV-related function names - moves the api calls to
kv:namespace delete
andkv:key delete
insidekv.ts
helpers.
-
#980
202f37d
Thanks @threepointone! - fix: throw appropriate error when we detect an unsupported version of nodeWhen we start up the CLI, we check what the minimum version of supported node is, and throw an error if it isn't at least 16.7. However, the script that runs this, imports
node:child_process
andnode:path
, which was only introduced in 16.7. It was backported to older versions of node, but only in last updates to majors. So for example, if someone used 14.15.4, the script would throw because it wouldn't be able to findnode:child_process
(but it would work on v14.19.2).The fix here is to not use the prefixed versions of these built-ins in the bootstrap script. Fixes #979
-
#956
1caa5f7
Thanks @threepointone! - fix: don't crash duringinit
ifgit
is not installedWhen a command isn't available on a system, calling
execa()
on it throws an error, and not just a non zero exitCode. This patch fixes the flow so we don't crash the whole process when that happens on testing the presence ofgit
when callingwrangler init
.Fixes #950
-
#970
35e780b
Thanks @GregBrimble! - fix: Fixes Pages Plugins and static asset routing.There was previously a bug where a relative pathname would be missing the leading slash which would result in routing errors.
-
#957
e0a0509
Thanks @JacobMGEvans! - refactor: Moving--legacy-env
out of global The--legacy-env
flag was in global scope, which only certain commands utilize the flag for functionality, and doesnt do anything for the other commands.resolves #933
-
#948
82165c5
Thanks @petebacondarwin! - fix: improve error message if custom build output is not foundThe message you get if Wrangler cannot find the output from the custom build is now more helpful. It will even look around to see if there is a suitable file nearby and make suggestions about what should be put in the
main
configuration.Closes #946
-
#952
ae3895e
Thanks @d3lm! - feat: use host specific callback urlTo allow OAuth to work on environments such as WebContainer we have to generate a host-specific callback URL. This PR uses
@webcontainer/env
to generate such URL only for running in WebContainer. Otherwise the callback URL stays unmodified.
-
#951
09196ec
Thanks @petebacondarwin! - fix: look for an alternate port in the dev command if the configured one is in usePreviously, we were only calling
getPort()
if the configured port was undefined. But since we were setting the default for this during validation, it was never undefined.Fixes #949
-
#963
5b03eb8
Thanks @threepointone! - fix: work with Cloudflare WARPUsing wrangler with Cloudflare WARP (https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/) requires using the Cloudflare certificate. This patch simply uses the certificate as NODE_EXTRA_CA_CERTS when we start wrangler.
Test plan:
- Turn on Cloudflare WARP/ Gateway with WARP
wrangler dev
- Turn on Cloudflare WARP/ Gateway with DoH
wrangler dev
- Turn off Cloudflare WARP
wrangler dev
-
#964
0dfd95f
Thanks @JacobMGEvans! - fix: KV not setting correctly The KV has URL inputs, which in the case of/
would get collapsed and lost. T:o handle special charactersencodeURIComponent
is implemented.resolves #961
- #947
38b7242
Thanks @GregBrimble! - Updated defaults and help of wrangler pages publish
-
#941
d84b568
Thanks @threepointone! - fix: bundle worker as iife if detected as a service workerWe detect whether a worker is a "modules" format worker by the presence of a
default
export. This is a pretty good heuristic overall, but sometimes folks can make mistakes. One situation that's popped up a few times, is people writing exports, but still writing it in "service worker" format. We detect this fine, and log a warning about the exports, but send it up with the exports included. Unfortunately, our runtime throws when we mark a worker as a service worker, but still has exports. This patch fixes it so that the exports are not included in a service-worker worker.Note that if you're missing an event listener, it'll still error with "No event handlers were registered. This script does nothing." but that's a better error than the SyntaxError even when the listener was there.
Fixes #937
-
#932
e95e5a0
Thanks @threepointone! - fix: log proper response status codes indev
During
dev
we log the method/url/statuscode for every req+res. This fix logs the correct details for every request.Fixes #931
- #930
bc28bea
Thanks @GregBrimble! - fix: Default to creating a new project when no existing ones are available for 'wrangler pages publish'
- #934
692ddc4
Thanks @GregBrimble! - fix: Suppress beta warning when operating in Pages' CI environment
-
#936
a0e0b26
Thanks @petebacondarwin! - fix: support Windows line-endings in TOML filesThe TOML parser that Wrangler uses crashes if there is a Windows line-ending in a comment. See iarna/iarna-toml#33.
According to the TOML spec, we should be able to normalize line-endings as we see fit. See https://toml.io/en/v1.0.0#:~:text=normalize%20newline%20to%20whatever%20makes%20sense.
This change normalizes line-endings of TOML strings before parsing to avoid hitting this bug.
Fixes #915
-
#928
7672f99
Thanks @threepointone! - ⛅️ Wrangler 2.0.0Wrangler 2.0 is a full rewrite. Every feature has been improved, while retaining as much backward compatibility as we could. We hope you love it. It'll only get better.
-
#926
7b38a7c
Thanks @threepointone! - polish: show paths of created files withwrangler init
This patch modifies the terminal when running
wrangler init
, to show the proper paths of files created during it (likepackage.json
,tsconfig.json
, etc etc). It also fixes a bug where we weren't detecting the existence ofsrc/index.js
for a named worker before asking to create it.
-
#924
3bdba63
Thanks @threepointone! - fix: withwrangler init
, test for existence ofpackage.json
/tsconfig.json
/.git
in the right locationsWhen running
wrangler.init
, we look for the existence ofpackage.json
, /tsconfig.json
/.git
when deciding whether we should create them ourselves or not. Becausename
can be a relative path, we had a bug where we don't starting look from the right directory. We also had a bug where we weren't even testing for the existence of the.git
directory correctly. This patch fixes that initial starting location, tests for.git
as a directory, and correctly decides when to create those files.
-
#922
e2f9bb2
Thanks @threepointone! - feat: offer to create a git repo when callingwrangler init
Worker projects created by
wrangler init
should also be managed by source control (popularly, git). This patch adds a choice inwrangler init
to make the created project into a git repository.Additionally, this fixes a bug in our tests where mocked
confirm()
andprompt()
calls were leaking between tests.Closes #847
-
#916
4ef5fbb
Thanks @petebacondarwin! - fix: display and error and help forwrangler init --site
The
--site
option is no longer supported. This change adds information about how to create a new Sites project by cloning a repository. It also adds links to the Worker Sites and Cloudflare Pages docs.
-
#908
f8dd31e
Thanks @threepointone! - fix: fix isolate prewarm logic forwrangler dev
When calling
wrangler dev
, we make a request to a special URL that "prewarms" the isolate running our Worker so that we can attach devtools etc to it before actually making a request. We'd implemented it wrongly, and because we'd silenced its errors, we weren't catching it. This patch fixes the logic (based on wrangler 1.x's implementation) and enables logging errors when the prewarm request fails.As a result, profiling starts working again as expected. Fixes #907
-
#919
13078e1
Thanks @threepointone! - fix: don't crash when tail event is nullSometime the "event" on a tail can be null. This patch makes sure we don't crash when that happens. Fixes #918
-
#913
dfeed74
Thanks @threepointone! - polish: add a deprecation warning to--inspect
ondev
We have a blogposts and docs that says you need to pass
--inspect
to use devtools and/or profile your Worker. In wrangler v2, we don't need to pass the flag anymore. Using it right now will throw an error, so this patch makes it a simple warning instead.
- #916
4ef5fbb
Thanks @petebacondarwin! - fix: add some space after the CLI help message when there is an error
-
#920
57cf221
Thanks @threepointone! - chore: don't minify bundlesWhen errors in wrangler happen, it's hard to tell where the error is coming from in a minified bundle. This patch removes the minification. We still set
process.env.NODE_ENV = 'production'
in the bundle so we don't run dev-only paths in things like React.This adds about 2 mb to the bundle, but imo it's worth it.
- #916
4ef5fbb
Thanks @petebacondarwin! - fix: update thegenerate
command to provide better deprecation messaging
- #914
9903526
Thanks @sidharthachatterjee! - fix: Ensure getting git branch doesn't fail on Windows
- #917
94d3d6d
Thanks @GregBrimble! - fix: Hit correct endpoint for 'wrangler pages publish'
-
#910
fe0344d
Thanks @taylorlee! - fix: support preview buckets for r2 bindingsAllows wrangler2 to perform preview & dev sessions with a different bucket than the published worker's binding.
This matches kv's preview_id behavior, and brings the wrangler2 implementation in sync with wrangler1.
-
#902
daed3c3
Thanks @petebacondarwin! - fix: show error if a string option is used without a valueFixes #883
-
#901
b246066
Thanks @threepointone! - chore: minify bundle, don't ship sourcemapsWe haven't found much use for sourcemaps in production, and we should probably minify the bundle anyway. This will also remove an dev only warnings react used to log.
-
#904
641cdad
Thanks @GregBrimble! - feat: Adds 'assets:' loader for Pages Functions.This lets users and Plugin authors include a folder of static assets in Pages Functions.
export { onRequest } from "assets:../folder/of/static/assets";
More information in our docs.
- #905
c57ff0e
Thanks @JacobMGEvans! - chore: removed Sentry and related reporting code. Automated reporting of Wrangler errors will be reimplemented after further planning.
-
#897
d0801b7
Thanks @threepointone! - polish: tweak the message when.dev.vars
is usedThis tweaks the mssage when a
.dev.vars
file is used so that it doesn't imply that the user has to copy the values from it into theirwrangler.toml
.
-
#880
aad1418
Thanks @GregBrimble! - fix: Stop unnecessarily amalgamating duplicate headers in Pages FunctionsPreviously,
set-cookie
multiple headers would be combined because of unexpected behavior in the spec.
- #892
b08676a
Thanks @GregBrimble! - fix: Adds the leading slash to Pages deployment manifests that the API expects, and fixes manifest generation on Windows machines.
-
#852
6283ad5
Thanks @JacobMGEvans! - feat: non-TTY check for required variables Added a check in non-TTY environments foraccount_id
,CLOUDFLARE_ACCOUNT_ID
andCLOUDFLARE_API_TOKEN
. Ifaccount_id
exists inwrangler.toml
thenCLOUDFLARE_ACCOUNT_ID
is not needed in non-TTY scope. TheCLOUDFLARE_API_TOKEN
is necessary in non-TTY scope and will always error if missing.resolves #827
-
#893
5bf17ca
Thanks @petebacondarwin! - fix: remove bold font from additional lines of warnings and errorsPreviously, when a warning or error was logged, the entire message was formatted in bold font. This change makes only the first line of the message bold, and the rest is formatted with a normal font.
-
#894
57c1354
Thanks @threepointone! - polish: s/DO NOT USE THIS/ IgnoredFollowup to #888, this replaces some more scary capitals with a more chill word.
- #893
5bf17ca
Thanks @petebacondarwin! - fix: add bold to theDeprecated
warning title
-
#882
1ad7570
Thanks @petebacondarwin! - feat: add support for reading build time env variables from a.env
fileThis change will automatically load up a
.env
file, if found, and apply its values to the current environment. An example would be to provide a specific CLOUDFLARE_ACCOUNT_ID value.Related to #190
-
#887
2bb4d30
Thanks @threepointone! - polish: accept Enter as a valid key in confirm dialogsInstead of logging "Unrecognised input" when hitting return/enter in a confirm dialog, we should accept it as a confirmation. This patch also makes the default choice "y" bold in the dialog.
-
#891
bae5ba4
Thanks @GregBrimble! - feat: Adds interactive prompts for the 'wrangler pages publish' and related commands.Additionally, those commands now read from
node_modules/.cache/wrangler/pages.json
to persist users' account IDs and project names.
-
#888
b77aa38
Thanks @threepointone! - polish: s/DEPRECATION/DeprecationThis removes the scary uppercase from DEPRECATION warnings. It also moves the service environment usage warning into
diagnostics
instead of logging it directly.
-
#879
f694313
Thanks @petebacondarwin! - feat: readvars
overrides from a local file forwrangler dev
The
vars
bindings can be specified in thewrangler.toml
configuration file. But "secret"vars
are usually only provided at the server - either by creating them in the Dashboard UI, or using thewrangler secret
command.It is useful during development, to provide these types of variable locally. When running
wrangler dev
we will look for a file called.dev.vars
, situated next to thewrangler.toml
file (or in the current working directory if there is nowrangler.toml
). Any values in this file, formatted like adotenv
file, will add to or overridevars
bindings provided in thewrangler.toml
.Related to #190
-
#843
da12cc5
Thanks @threepointone! - fix:site.entry-point
is no longer a hard deprecationTo make migration of v1 projects easier, Sites projects should still work, including the
entry-point
field (which currently errors out). This enablessite.entry-point
as a valid entry point, with a deprecation warning.
-
#848
0a79d75
Thanks @petebacondarwin! - polish: improve consistency of warnings and errorsRelated to #377
-
#877
97f945f
Thanks @caass! - Treat the "name" parameter inwrangler init
as a path.This means that running
wrangler init .
will create a worker in the current directory, and the worker's name will be the name of the current directory.You can also run
wrangler init path/to/my-worker
and a worker will be created at[CWD]/path/to/my-worker
with the namemy-worker
,
-
#851
277b254
Thanks @threepointone! - polish: do not log the error object when refreshing a token failsWe handle the error anyway (by doing a fresh login) which has its own logging and messaging. In the future we should add a DEBUG mode that logs all requests/errors/warnings, but that's for later.
-
#869
f1423bf
Thanks @threepointone! - feat: experimental--node-compat
/config.node_compat
This adds an experimental node.js compatibility mode. It can be enabled by adding
node_compat = true
inwrangler.toml
, or by passing--node-compat
as a command line arg fordev
/publish
commands. This is currently powered by@esbuild-plugins/node-globals-polyfill
(which in itself is powered byrollup-plugin-node-polyfills
).We'd previously added this, and then removed it because the quality of the polyfills isn't great. We're reintroducing it regardless so we can start getting feedback on its usage, and it sets up a foundation for replacing it with our own, hopefully better maintained polyfills.
Of particular note, this means that what we promised in https://blog.cloudflare.com/announcing-stripe-support-in-workers/ now actually works.
This patch also addresses some dependency issues, specifically leftover entries in package-lock.json.
- #790
331c659
Thanks @sidharthachatterjee! - feature: Adds 'wrangler pages publish' (alias 'wrangler pages deployment create') command.
-
#866
8b227fc
Thanks @caass! - Add a runtime check forwrangler dev
local mode to avoid erroring in environments with noAsyncLocalStorage
classCertain runtime APIs are only available to workers during the "request context", which is any code that returns after receiving a request and before returning a response.
Miniflare emulates this behavior by using an
AsyncLocalStorage
and checking at runtime to see if you're using those APIs during the request context.In certain environments
AsyncLocalStorage
is unavailable, such as in a webcontainer. This function figures out if we're able to run those "request context" checks and returns a set of options that indicate to miniflare whether to run the checks or not.
-
#829
f08aac5
Thanks @JacobMGEvans! - feat: Add validation to thename
field in configuration. The validation will warn users that the field can only be "type string, alphanumeric, underscores, and lowercase with dashes only" using the same RegEx as the backendresolves #795 #775
-
#868
6ecb1c1
Thanks @threepointone! - feat: implement service environments + durable objectsNow that the APIs for getting migrations tags of services works as expected, this lands support for publishing durable objects to service environments, including migrations. It also removes the error we used to throw when attempting to use service envs + durable objects.
Fixes #739
-
#838
9c025c4
Thanks @threepointone! - fix: remove timeout on custom builds, and make sure logs are visibleThis removes the timeout we have for custom builds. We shouldn't be applying this timeout anyway, since it doesn't block wrangler, just the user themselves. Further, in #759, we changed the custom build's process stdout/stderr config to "pipe" to pass tests, however that meant we wouldn't see logs in the terminal anymore. This patch removes the timeout, and brings back proper logging for custom builds.
- #349
9d04a68
Thanks @GregBrimble! - chore: rename--script-path
to--outfile
forwrangler pages functions build
command.
-
#836
28e3b17
Thanks @threepointone! - fix: toggleworkers.dev
subdomains only when requiredThis fix -
- passes the correct query param to check whether a workers.dev subdomain has already been published/enabled
- thus enabling it only when it's not been enabled
- it also disables it only when it's explicitly knows it's already been enabled
The effect of this is that publishes are much faster.
-
#794
ee3475f
Thanks @JacobMGEvans! - fix: Error messaging from failed login would dump aJSON.parse
error in some situations. Added a fallback if.json
fails to parse it will attempt.text()
then throw result. If both attempts to parse fail it will throw anUnknownError
with a message showing where it originated.resolves #539
-
#840
32f6108
Thanks @threepointone! - fix: make wrangler work on node v18There's some interference between our data fetching library
undici
and node 18's newfetch
and co. (powered byundici
internally) which replaces the filename ofFile
s attached toFormData
s with a genericblob
(likely this code - https://github.com/nodejs/undici/blob/615f6170f4bd39630224c038d1ea5bf505d292af/lib/fetch/formdata.js#L246-L250). It's still not clear why it does so, and it's hard to make an isolated example of this.Regardless, disabling the new
fetch
functionality makesundici
use its own base classes, avoiding the problem for now, and unblocking our release. We'll keep investigating and look for a proper fix.Unblocks #834
-
#824
62af4b6
Thanks @threepointone! - feat:publish --dry-run
It can be useful to do a dry run of publishing. Developers want peace of mind that a project will compile before actually publishing to live servers. Combined with
--outdir
, this is also useful for testing the output ofpublish
. Further, it gives developers a chance to upload our generated sourcemap to a service like sentry etc, so that errors from the worker can be mapped against actual source code, but before the service actually goes live.
- #798
feecc18
Thanks @GregBrimble! - fix: Allowsnext()
to take just a pathname with Pages Functions.
-
#839
f2d6de6
Thanks @threepointone! - fix: persist dev experimental storage state in feature specific dirsWith
--experimental-enable-local-persistence
indev
, we were clobbering a single folder with data from kv/do/cache. This patch gives individual folders for them. It also enables persistence even when this is not true, but that stays only for the length of a session, and cleans itself up when the dev session ends.Fixes #830
-
#820
60c409a
Thanks @petebacondarwin! - fix: display a warning if the user has aminiflare
section in theirwrangler.toml
.Closes #799
- #796
3e0db3b
Thanks @GregBrimble! - fix: Makes Response Headers object mutable after a call tonext()
in Pages Functions
-
#814
51fea7c
Thanks @threepointone! - fix: disallow setting account_id in named service environmentsMuch like #641, we don't want to allow setting account_id with named service environments. This is so that we use the same account_id for multiple environments, and have them group together in the dashboard.
-
#823
4a00910
Thanks @threepointone! - fix: don't log an error whenwrangler dev
is cancelled earlyWe currently log an
AbortError
with a stack if we exitwrangler dev
's startup process before it's done. This fix skips logging that error (since it's not an exception).Test plan:
cd packages/wrangler npm run build cd ../../examples/workers-chat-demo npx wrangler dev # hit [x] as soon as the hotkey shortcut bar shows
-
#815
025c722
Thanks @threepointone! - fix: ensure that bundle is generated to es2020 targetThe default tsconfig generated by tsc uses
target: "es5"
, which we don't support. This fix ensures that we output es2020 modules, even if tsconfig asks otherwise.
- #349
9d04a68
Thanks @GregBrimble! - feature: Adds a--plugin
option towrangler pages functions build
which compiles a Pages Plugin. More information about Pages Plugins can be found here. This wrangler build is required for both the development of, and inclusion of, plugins.
- #822
4302172
Thanks @GregBrimble! - chore: Add help messages forwrangler pages project
andwrangler pages deployment
-
#837
206b9a5
Thanks @threepointone! - polish: replace 🦺 with⚠️ I got some feedback that the construction worker jacket (?) icon for deprecations is confusing, especially because it's an uncommon icon and not very big in the terminal. This patch replaces it with a more familiar warning symbol.
-
#824
62af4b6
Thanks @threepointone! - feat:publish --outdir <path>
It can be useful to introspect built assets. A leading usecase is to upload the sourcemap that we generate to services like sentry etc, so that errors from the worker can be mapped against actual source code. We introduce a
--outdir
cli arg to specify a path to generate built assets at, which doesn't get cleaned up after publishing. We are not adding this towrangler.toml
just yet, but could in the future if it looks appropriate there.
-
#811
8c2c7b7
Thanks @JacobMGEvans! - feat: Addedminify
as a configuration option and a cli arg, which will minify code fordev
andpublish
resolves #785
-
#782
34552d9
Thanks @GregBrimble! - feature: Add 'pages create project [name]' command.This command will create a Pages project with a given name, and optionally set its
--production-branch=[production]
.
- #772
a852e32
Thanks @JacobMGEvans! - fix: We want to prevent any user created code from sending Events to Sentry, which can be captured byuncaughtExceptionMonitor
listener. Miniflare code can run user code on the same process as Wrangler, so we want to returnnull
if@miniflare
is present in the Event frames.
-
#778
85b0c31
Thanks @threepointone! - feat: optionally send zone_id with a routeThis enables optionally passing a route as
{pattern: string, zone_id: string}
. There are scenarios where we need to explicitly pass a zone_id to the api, so this enables that.Some nuance: The errors from the api aren't super useful when invalid values are passed, but that's something to further work on.
This also fixes some types in our cli parsing.
Fixes #774
-
#797
67fc4fc
Thanks @threepointone! - feat: optionally sendzone_name
with routesA followup to #778, this lets you send an optional
zone_name
with routes. This is particularly useful when using ssl for saas (https://developers.cloudflare.com/ssl/ssl-for-saas/).Fixes #793
-
#813
5c59f97
Thanks @threepointone! - add a warning if service environments are being used.Service environments are not ready for widespread usage, and their behaviour is going to change. This adds a warning if anyone uses them.
Closes #809
-
#789
5852bba
Thanks @threepointone! - polish: don't log all errors when logging inThis removes a couple of logs we had for literally every error in our oauth flow. We throw the error and handle it separately anyway, so this is a safe cleanup.
Fixes #788
-
#806
b24aeb5
Thanks @threepointone! - fix: check for updates on the right channelThis makes the update checker run on the channel that the version being used runs on.
-
#807
7e560e1
Thanks @threepointone! - fix: readisLegacyEnv
correctlyThis fixes the signature for
isLegacyEnv()
since it doesn't use args, and we fix reading legacy_env correctly when creating a draft worker when creating a secret.
-
#779
664803e
Thanks @threepointone! - chore: update packagesThis updates some dependencies. Some highlights -
- updates to
@iarna/toml
means we can have mixed types for inline arrays, which is great for #774 / #778 - I also moved timeago.js to
devDependencies
since it already gets compiled into the bundle - updates to
esbuild
brings along a number of smaller fixes for modern js
- updates to
-
#810
0ce47a5
Thanks @caass! - Makewrangler tail
TTY-aware, and stop printing non-JSON in JSON modeCloses #493
2 quick fixes:
- Check
process.stdout.isTTY
at runtime to determine whether to default to "pretty" or "json" output for tailing. - Only print messages like "Connected to {worker}" if in "pretty" mode (errors still throw strings)
- Check
-
#752
6d43e94
Thanks @petebacondarwin! - fix: add a warning ifdev
is defaulting to the latest compatibility-dateFixes #741
-
#767
836ad59
Thanks @threepointone! - fix: use cwd for--experiment-enable-local-persistence
This sets up
--experiment-enable-local-persistence
to explicitly useprocess.cwd() + wrangler-local-state
as a path to store values. Without it, local mode uses the temp dir that we use to bundle the worker, which gets wiped out on ending wrangler dev. In the future, based on usage, we may want to make the path configurable as well.Fixes #766
-
#723
7942936
Thanks @threepointone! - fix: spread tail messages when loggingLogged messages (via console, etc) would previously be logged as an array of values. This spreads it when logging to match what is expected.
-
#756
8e38442
Thanks @threepointone! - fix: resolve raw file bindings correctly inwrangler dev
local modeFor
wasm_modules
/text_blobs
/data_blobs
in local mode, we need to rewrite the paths as absolute so that they're resolved correctly by miniflare. This also expands some coverage for local modewrangler dev
.
- #699
ea8e701
Thanks @JacobMGEvans! - polish: added logout and login to helpstring message.
-
#728
0873049
Thanks @threepointone! - fix: only send durable object migrations when requiredWe had a bug where even if you'd published a script with migrations, we would still send a blank set of migrations on the next round. The api doesn't accept this, so the fix is to not do so. I also expanded test coverage for migrations.
Fixes #705
-
#763
f72c943
Thanks @JacobMGEvans! - feat: Added the update check that will check the package once a day against the beta release,distTag
can be changed later, then prints the latestbeta version to the user.resolves #762
-
#695
48fa89b
Thanks @caass! - fix: stop wrangler spamming console after loginIf a user hasn't logged in and then they run a command that needs a login they'll get bounced to the login flow. The login flow (if completed) would write their shiny new OAuth2 credentials to disk, but wouldn't reload the in-memory state. This led to issues like #693, where even though the user was logged in on-disk, wrangler wouldn't be aware of it.
We now update the in-memory login state each time new credentials are written to disk.
-
#734
a1dadac
Thanks @threepointone! - fix: exit dev if build fails on first runBecause of evanw/esbuild#1037, we can't recover dev if esbuild fails on first run. The workaround is to end the process if it does so, until we have a better fix.
Reported in #731
-
#757
13e57cd
Thanks @sidharthachatterjee! - feature: Add wrangler pages project listAdds a new command to list your projects in Cloudflare Pages.
-
#745
6bc3e85
Thanks @petebacondarwin! - feat: add hotkey to clear the console inwrangler dev
Closes #388
-
#747
db6b830
Thanks @petebacondarwin! - refactor: removeprocess.exit()
from the pages codeThis enables simpler testing, as we do not have to spawn new child processes to avoid the
process.exit()
from killing the jest process.As part of the refactor, some of the
Error
classes have been moved to a sharederrors.ts
file.
-
#726
c4e5dc3
Thanks @threepointone! - fix: assume a worker is a module worker only if it has adefault
exportThis tweaks the logic that guesses worker formats to check whether a
default
export is defined on an entry point before assuming it's a module worker.
-
#735
c38ae3d
Thanks @threepointone! -text_blobs
/Text module support for service worker format in local modeThis adds support for
text_blobs
/Text module support in local mode. Now that cloudflare/miniflare#228 has landed in miniflare (thanks @caass!), we can use that in wrangler as well.
-
#743
ac5c48b
Thanks @threepointone! - feat: implement[data_blobs]
This implements
[data_blobs]
support for service-worker workers, as well as enabling Data module support for service-worker workers.data_blob
is a supported binding type, but we never implemented support for it in v1. This implements support, and utilises it for supporting Data modules in service worker format. Implementation wise, it's incredibly similar to how we implementedtext_blobs
, with relevant changes.Partial fix for #740 pending local mode support.
-
#753
cf432ac
Thanks @petebacondarwin! - fix: distinguish the command hotkeys in wrangler devCloses #354
-
#746
3e25dcb
Thanks @petebacondarwin! - fix: remove superfluous debugger log messages from local devCloses #387
-
#758
9bd95ce
Thanks @sidharthachatterjee! - feature: Add wrangler pages deployment listRenders a list of deployments in a Cloudflare Pages project
- #733
91873e4
Thanks @JacobMGEvans! - polish: improved visualization of the deprecation messages between serious and warnings with emojis. This also improves the delineation between messages.
-
#738
c04791c
Thanks @petebacondarwin! - fix: add support for cron triggers indev --local
modeCurrently, I don't know if there is support for doing this in "remote" dev mode.
Resolves #737
-
#732
c63ea3d
Thanks @JacobMGEvans! - fix: abort async operations in theRemote
component to avoid unwanted side-effects When theRemote
component is unmounted, we now signal outstandingfetch()
requests, andwaitForPortToBeAvailable()
tasks to cancel them. This prevents unexpected requests from appearing after the component has been unmounted, and also allows the process to exit cleanly without a delay.fixes #375
-
#719
6503ace
Thanks @petebacondarwin! - fix: ensure the correct worker name is published in legacy environmentsWhen a developer uses
--env
to specify an environment name, the Worker name should be computed from the top-level Worker name and the environment name.When the given environment name does not match those in the wrangler.toml, we error. But if no environments have been specified in the wrangler.toml, at all, then we only log a warning and continue.
In this second case, we were reusing the top-level environment, which did not have the correct legacy environment fields set, such as the name. Now we ensure that such an environment is created as needed.
See #680 (comment)
-
#708
763dcb6
Thanks @threepointone! - fix: unexpected commands and arguments should throwThis enables strict mode in our command line parser (yargs), so that unexpected commands and options uniformly throw errors.
Fixes #706
-
#713
18d09c7
Thanks @threepointone! - fix: don't fetch zone id forwrangler dev --local
We shouldn't try to resolve a domain/route to a zone id when starting in local mode (since there may not even be network).
-
#692
52ea60f
Thanks @threepointone! - fix: do not deploy to workers.dev when routes are defined in an environmentWhen
workers_dev
is not configured, we had a bug where it would default to true inside an environment even when there were routes defined, thus publishing both to aworkers.dev
subdomain as well as the defined routes. The fix is to defaultworkers_dev
toundefined
, and check when publishing whether or not to publish toworkers.dev
/defined routes.Fixes #690
-
#687
8f7ac7b
Thanks @petebacondarwin! - fix: add warning aboutwrangler dev
with remote Durable ObjectsDurable Objects that are being bound by
script_name
will not be isolated from the live data during development withwrangler dev
. This change simply warns the developer about this, so that they can back out before accidentally changing live data.Fixes #319
- #661
6967086
Thanks @JacobMGEvans! - polish: add "Beta" messaging around the CLI command for Pages. Explicitly specifying the command is Beta, not to be confused with Pages itself which is production ready.
-
#709
7e8ec9a
Thanks @threepointone! - fix: trigger login flow if refreshtoken isn't validIf the auth refresh token isn't valid, then we should trigger the login flow. Reported in #316
-
#702
241000f
Thanks @threepointone! - fix: setup jsx loaders when guessing worker format- We consider jsx to be regular js, and have setup our esbuild process to process js/mjs/cjs files as jsx.
- We use a separate esbuild run on an entry point file when trying to guess the worker format, but hadn't setup the loaders there.
- So if just the entrypoint file has any jsx in it, then we error because it can't parse the code.
The fix is to add the same loaders to the esbuild run that guesses the worker format.
Reported in #701
-
#711
3dac1da
Thanks @threepointone! - fix: defaultwrangler tail
to pretty printFixes #707
-
#712
fb53fda
Thanks @threepointone! - feat: Non-interactive modeContinuing the work from #325, this detects when wrangler is running inside an environment where "raw" mode is not available on stdin, and disables the features for hot keys and the shortcut bar. This also adds stubs for testing local mode functionality in
local-mode-tests
, and deletes the previous hackydev2.test.tsx
.Fixes #322
-
#716
6987cf3
Thanks @threepointone! - feat: path to a customtsconfig
This adds a config field and a command line arg
tsconfig
for passing a path to a custom typescript configuration file. We don't do any typechecking, but we do pass it along to our build process so things likecompilerOptions.paths
get resolved correctly.
-
#665
62a89c6
Thanks @caass! - fix: validate that bindings have unique namesWe don't want to have, for example, a KV namespace named "DATA" and a Durable Object also named "DATA". Then it would be ambiguous what exactly would live at
env.DATA
(or in the case of service workers, theDATA
global) which could lead to unexpected behavior -- and errors.Similarly, we don't want to have multiple resources of the same type bound to the same name. If you've been working with some KV namespace called "DATA", and you add a second namespace but don't change the binding to something else (maybe you're copying-and-pasting and just changed out the
id
), you could be reading entirely the wrong stuff out of your KV store.So now we check for those sorts of situations and throw an error if we find that we've encountered one.
-
#698
e3e3243
Thanks @threepointone! - feat: injectprocess.env.NODE_ENV
into scriptsAn extremely common pattern in the js ecosystem is to add additional behaviour gated by the value of
process.env.NODE_ENV
. For example, React leverages it heavily to add dev-time checks and warnings/errors, and to load dev/production versions of code. By doing this substitution ourselves, we can get a significant runtime boost in libraries/code that leverage this.This does NOT tackle the additional features of either minification, or proper node compatibility, or injecting wrangler's own environment name, which we will tackle in future PRs.
-
#680
8e2cbaf
Thanks @JacobMGEvans! - refactor: support backwards compatibility with environment names and related CLI flags- When in Legacy environment mode we should not compute name field if specified in an environment.
- Throw an Error when
--env
and--name
are used together in Legacy Environment, except for Secrets & Tail which are using a special casegetLegacyScriptName
for parity with Wrangler1 - Started the refactor for args being utilized at the Config level, currently checking for Legacy Environment only.
Fixes #672
-
#684
82ec7c2
Thanks @GregBrimble! - fix: Fix--binding
option forwrangler pages dev
.We'd broken this with #581. This reverts that PR, and fixes it slightly differently. Also added an integration test to ensure we don't regress in the future.
-
#678
82e4143
Thanks @threepointone! - fix: cleanup afterpages dev
testsWe weren't killing the process started by wrangler whenever its parent was killed. This fix is to listen on SIGINT/SIGTERM and kill that process. I also did some minor configuration cleanups.
-
#675
e88a54e
Thanks @threepointone! - fix: resolve non-js modules correctly in local modeIn #633, we missed passing a cwd to the process that runs the miniflare cli. This broke how miniflare resolves modules, and led back to the dreaded "path should be a
path.relative()
d string" error. The fix is to simply pass the cwd to thespawn
call.Test plan:
cd packages/wrangler npm run build cd ../workers-chat-demo npx wrangler dev --local
-
#668
3dcdb0d
Thanks @petebacondarwin! - fix: tighten up the named environment configurationNow, when we normalize and validate the raw config, we pass in the currently active environment name, and the config that is returned contains all the environment fields correctly normalized (including inheritance) at the top level of the config object. This avoids other commands from having to check both the current named environment and the top-level config for such fields.
Also, now, handle the case where the active environment name passed in via the
--env
command line argument does not match any of the named environments in the configuration:- This is an error if there are named environments configured;
- or only a warning if there are no named environments configured.
-
#633
003f3c4
Thanks @JacobMGEvans! - refactor: create a custom CLI wrapper around Miniflare APIThis allows us to tightly control the options that are passed to Miniflare. The current CLI is setup to be more compatible with how Wrangler 1 works, which is not optimal for Wrangler 2.
-
#633
84c857e
Thanks @JacobMGEvans! - fix: ensure asset keys are relative to the project rootPreviously, asset file paths were computed relative to the current working directory, even if we had used
-c
to run Wrangler on a project in a different directory to the current one.Now, assets file paths are computed relative to the "project root", which is either the directory containing the wrangler.toml or the current working directory if there is no config specified.
-
#673
456e1da
Thanks @petebacondarwin! - fix: allow thebuild
field to be inherited/overridden in a named environment"Now the
build
field can be specified within a named environment, overriding whatever may appear at the top level.Resolves #588
-
#650
d3d1ff8
Thanks @petebacondarwin! - feat: makemain
an inheritable environment fieldSee #588
- #650
f0eed7f
Thanks @petebacondarwin! - fix: make validation error messages more consistent
- #662
612952b
Thanks @JacobMGEvans! - bugfix: use alias-e
for--env
to prevent scripts using Wrangler 1 from breaking when switching to Wrangler 2.
-
#671
ef0aaad
Thanks @GregBrimble! - fix: don't exit on initial Pages Functions compilation failurePreviously, we'd exit the
wrangler pages dev
process if we couldn't immediately compile a Worker from thefunctions
directory. We now log the error, but don't exit the process. This means that proxy processes can be cleaned up cleanly on SIGINT and SIGTERM, and it matches the behavior of if a compilation error is introduced once already running (we don't exit then either).
-
#667
e29a241
Thanks @threepointone! - fix: delete unused[site]
assetsWe discovered critical issues with the way we expire unused assets with
[site]
(see #666, cloudflare/wrangler-legacy#2224), that we're going back to the legacy manner of handling unused assets, i.e- deleting unused assets.Fixes #666
-
#640
2a2d50c
Thanks @caass! - Error if the user is trying to implement DO's in a service workerDurable Objects can only be implemented in Module Workers, so we should throw if we detect that the user is trying to implement a Durable Object but their worker is in Service Worker format.
-
#656
aeb0fe0
Thanks @threepointone! - fix: resolve npm modules correctlyWhen implementing legacy module specifiers, we didn't throughly test the interaction when there weren't any other files next to the entry worker, and importing npm modules. It would create a Regex that matched every import, and fail because a file of that name wasn't present in the source directory. This fix constructs a better regex, applies it only when there are more files next to the worker, and increases test coverage for that scenario.
Fixes #655
-
#647
f3f3907
Thanks @petebacondarwin! - feat: add support for--ip
andconfig.dev.ip
in the dev commandNote that this change modifies the default listening address to
localhost
, which is different to127.0.0.1
, which is what Wrangler 1 does. For most developers this will make no observable difference, since the default host mapping in most OSes fromlocalhost
to127.0.0.1
.Resolves #584
- #627
ff53f4e
Thanks @petebacondarwin! - fix: do not warn about miniflare in the configuration
-
#649
e0b9366
Thanks @threepointone! - fix: useexpiration_ttl
to expire assets with[site]
This switches how we expire static assets with
[site]
uploads to useexpiration_ttl
instead ofexpiration
. This is because we can't trust the time that a deploy target may provide (like in cloudflare/wrangler-legacy#2224).
-
#599
7d4ea43
Thanks @caass! - Force-open a chromium-based browser for devtoolsWe rely on Chromium-based devtools for debugging workers, so when opening up the devtools URL, we should force a chromium-based browser to launch. For now, this means checking (in order) for Chrome and Edge, and then failing if neither of those are available.
-
#567
05b81c5
Thanks @threepointone! - fix: consolidategetEntry()
logicThis consolidates some logic into
getEntry()
, namely includingguessWorkerFormat()
and custom builds. This simplifies the code for bothdev
andpublish
.- Previously, the implementation of custom builds inside
dev
assumed it could be a long running process; however it's not (else consider thatpublish
would never work). - By running custom builds inside
getEntry()
, we can be certain that the entry point exists as we validate it and before we enterdev
/publish
, simplifying their internals - We don't have to do periodic checks inside
wrangler dev
because it's now a one shot build (and always should have been) - This expands test coverage a little for both
dev
andpublish
. - The 'format' of a worker is intrinsic to its contents, so it makes sense to establish its value inside
getEntry()
- This also means less async logic inside
<Dev/>
, which is always a good thing
- Previously, the implementation of custom builds inside
- #628
b640ab5
Thanks @caass! - Validate that ifroute
exists in wrangler.toml,routes
does not (and vice versa)
-
#591
42c2c0f
Thanks @petebacondarwin! - fix: add warning about setting upstream-protocol tohttp
We have not implemented setting upstream-protocol to
http
and currently do not intend to.This change just adds a warning if a developer tries to do so and provides a link to an issue where they can add their use-case.
-
#596
187264d
Thanks @threepointone! - feat: support wrangler 1.x module specifiers with a deprecation warningThis implements wrangler 1.x style module specifiers, but also logs a deprecation warning for every usage.
Consider a project like so:
project ├── index.js └── some-dependency.js
where the content of
index.js
is:import SomeDependency from "some-dependency.js"; addEventListener("fetch", event => { // ... });
wrangler
1.x would resolveimport SomeDependency from "some-dependency.js";
to the filesome-dependency.js
. This will work inwrangler
v2, but it will log a deprecation warning. Instead, you should rewrite the import to specify that it's a relative path, like so:- import SomeDependency from "some-dependency.js"; + import SomeDependency from "./some-dependency.js";
In a near future version, this will become a breaking deprecation and throw an error.
(This also updates
workers-chat-demo
to use the older style specifier, since that's how it currently is at https://github.com/cloudflare/workers-chat-demo)Known issue: This might not work as expected with
.js
/.cjs
/.mjs
files as expected, but that's something to be fixed overall with the module system.Closes #586
- #579
2f0e59b
Thanks @JacobMGEvans! - feat: Incomplete subcommands render a help message for that specific subcommand.
-
#559
16fb5e6
Thanks @petebacondarwin! - feat: support adding secrets in non-interactive modeNow the user can pipe in the secret value to the
wrangler secret put
command. For example:cat my-secret.txt | wrangler secret put secret-key --name worker-name
This requires that the user is logged in, and has only one account, or that the
account_id
has been set inwrangler.toml
.Fixes #170
-
#597
94c2698
Thanks @caass! - Deprecatewrangler route
,wrangler route list
, andwrangler route delete
Users should instead modify their wrangler.toml or use the
--routes
flag when publishing to manage routes.
- #564
ffd5c0d
Thanks @GregBrimble! - Request Pages OAuth scopes when logging in
-
#638
06f9278
Thanks @threepointone! - polish: add a small banner for commandsThis adds a small banner for most commands. Specifically, we avoid any commands that maybe used as a parse input (like json into jq). The banner itself simply says "⛅️ wrangler" with an orange underline.
-
#561
6e9a219
Thanks @threepointone! - fix: resolve modules correctly inwrangler dev --local
This is an alternate fix to cloudflare/miniflare#205, and fixes the error where miniflare would get confused resolving relative modules on macs because of
/var
//private/var
being symlinks. Instead, werealpathSync
the bundle path before passing it on to miniflare, and that appears to fix the problem.Test plan:
cd packages/wrangler npm run build cd ../workers-chat-demo npx wrangler dev --local
Fixes #443
-
#592
56886cf
Thanks @caass! - Stop reporting breadcrumbs to sentrySentry's SDK automatically tracks "breadcrumbs", which are pieces of information that get tracked leading up to an exception. This can be useful for debugging errors because it gives better insight into what happens before an error occurs, so you can more easily understand and recreate exactly what happened before an error occurred.
Unfortunately, Sentry automatically includes all
console
statements. And since we use the console a lot (e.g. logging every request received inwrangler dev
), this is mostly useless. Additionally, since developers frequently use the console to debug their workers we end up with a bunch of data that is not only irrelevant to the reported error, but also contains data that could be potentially sensitive.For now, we're turning off breadcrumbs entirely. Later, we might wish to add our own breadcrumbs manually (e.g. add a "wrangler dev" breadcrumb when a user runs
wrangler dev
), at which point we can selectively enable breadcrumbs to catch only the ones we've put in there ourselves.
-
#645
61aea30
Thanks @petebacondarwin! - fix: improve authentication logging and warnings- If a user has previously logged in via Wrangler 1 with an API token, we now display a helpful warning.
- When logging in and out, we no longer display the path to the internal user auh config file.
- When logging in, we now display an initial message to indicate the authentication flow is starting.
Fixes #526
-
#608
a7fa544
Thanks @sidharthachatterjee! - fix: Ensure generateConfigFromFileTree generates config correctly for multiple splatsFunctions with multiple parameters, like /near/[latitude]/[longitude].ts wouldn't work. This fixes that.
-
#580
8013e0a
Thanks @petebacondarwin! - feat: add support for--local-protocol=https
towrangler dev
This change adds full support for the setting the protocol that the localhost proxy server listens to. Previously, it was only possible to use
HTTP
. But now you can set it toHTTPS
as well.To support
HTTPS
, Wrangler needs an SSL certificate. Wrangler now generates a self-signed certificate, as needed, and caches it in the~/.wrangler/local-cert
directory. These certificates expire after 30 days and are regenerated by Wrangler as needed.Note that if you use HTTPS then your browser will complain about the self-signed and you must tell it to accept the certificate before it will let you access the page.
-
#639
5161e1e
Thanks @petebacondarwin! - refactor: initialize the user auth state synchronouslyWe can now initialize the user state synchronously, which means that we can remove the checks for whether it has been done or not in each of the user auth functions.
- #580
aaac8dd
Thanks @petebacondarwin! - fix: validate that local_protocol and upstream_protocol can only take "http" or "https"
-
#568
b6f2266
Thanks @caass! - Show an actionable error message when publishing to a workers.dev subdomain that hasn't been created yet.When publishing a worker to workers.dev, you need to first have registered your workers.dev subdomain (e.g. my-subdomain.workers.dev). We now check to ensure that the user has created their subdomain before uploading a worker to workers.dev, and if they haven't, we provide a link to where they can go through the workers onboarding flow and create one.
-
#641
21ee93e
Thanks @petebacondarwin! - fix: error if a non-legacy service environment tries to define a worker nameGiven that service environments all live off the same worker, it doesn't make sense for them to have different names.
This change adds validation to tell the developer to remove such
name
fields in service environment config.Fixes #623
-
#646
c75cfb8
Thanks @threepointone! - fix: defaultwatch_dir
tosrc
of project directoryVia wrangler 1, when using custom builds in
wrangler dev
,watch_dir
should default tosrc
of the "project directory" (i.e - wherever thewrangler.toml
is defined if it exists, else in the cwd.Fixes #631
-
#621
e452a04
Thanks @petebacondarwin! - fix: stop checking for open port once it has timed out inwaitForPortToBeAvailable()
Previously, if
waitForPortToBeAvailable()
timed out, thecheckPort()
function would continue to be called. Now we clean up fully once the promise is resolved or rejected.
- #600
1bbd834
Thanks @skirsten! - fix: use environment specific and inherited config values inpublish
-
#577
7faf0eb
Thanks @threepointone! - fix:config.site.entry-point
as a breaking deprecationThis makes configuring
site.entry-point
in config as a breaking deprecation, and throws an error. We do this because existing apps withsite.entry-point
won't work in v2.
-
#578
c56847c
Thanks @threepointone! - fix: gracefully fail if we can't create~/.wrangler/reporting.toml
In some scenarios (CI/CD, docker, etc), we won't have write access to
~/.wrangler
. We already don't write a configuration file there if one passes aCF_API_TOKEN
/CLOUDFLARE_API_TOKEN
env var. This also adds a guard when writing the error reporting configuration file.
-
#621
e452a04
Thanks @petebacondarwin! - fix: check for the correct inspector port in local devPreviously, the
useLocalWorker()
hook was being passed the wrong port for theinspectorPort
prop.Once this was fixed, it became apparent that we were waiting for the port to become free in the wrong place, since this port is already being listened to in
useInspector()
by the time we were starting the check.Now, the check to see if the inspector port is free is done in
useInspector()
, which also means thatRemote
benefits from this check too.
-
#587
49869a3
Thanks @threepointone! - feat: expire unused assets in[site]
uploadsThis expires any previously uploaded assets when using a Sites /
[site]
configuration. Because we currently do a full iteration of a namespace's keys when publishing, for rapidly changing sites this means that uploads get slower and slower. We can't just delete unused assets because it leads to occasional 404s on older publishes while we're publishing. So we expire previous assets while uploading new ones. The implementation/constraints of the kv api means that uploads may become slower, but should hopefully be faster overall. These optimisations also only matter for rapidly changing sites, so common usecases still have the same perf characteristics.
- #580
9ef36a9
Thanks @petebacondarwin! - fix: improve validation error message for fields that must be one of a selection of choices
-
#557
835c3ae
Thanks @threepointone! - fix: wrangler dev on unnamed workers in remote modeWith unnamed workers, we use the filename as the name of the worker, which isn't a valid name for workers because of the
.
(This break was introduced in #545). The preview service accepts unnamed workers and generates a hash anyway, so the fix is to simply not send it, and use the host that the service provides.
-
#523
8c99449
Thanks @threepointone! - feat: secrets + environmentsThis implements environment support for
wrangler secret
(both legacy and services). We now consistently generate the right script name across commands with thegetScriptName()
helper.Based on the work by @mitchelvanbever in #95.
-
#554
18ac439
Thanks @petebacondarwin! - fix: limit bulk put API requests to batches of 5,000The
kv:bulk put
command now batches up put requests in groups of 5,000, displaying progress for each request.
-
#437
2805205
Thanks @jacobbednarz! - feat: useCLOUDFLARE_...
environment variables deprecatingCF_...
Now one should use
CLOUDFLARE_API_TOKEN
,CLOUDFLARE_ACCOUNT_ID
andCLOUDFLARE_API_BASE_URL
rather thanCF_API_TOKEN
,CF_ACCOUNT_ID
andCF_API_BASE_URL
, which have been deprecated.If you use the deprecated variables they will still work but you will see a warning message.
Within the Cloudflare tooling ecosystem, we have a mix of
CF_
andCLOUDFLARE_
for prefixing environment variables. Until recently, many of the tools were fine withCF_
however, there started to be conflicts with external tools (such as Cloudfoundary CLI), which also usesCF_
as a prefix, and would potentially be reading and writing the same value the Cloudflare tooling.The Go SDK1, Terraform2 and cf-terraforming3 have made the jump to the
CLOUDFLARE_
prefix for environment variable prefix.In future, all SDKs will use this prefix for consistency and to allow all the tooling to reuse the same environment variables in the scenario where they are present.
-
#530
fdb4afd
Thanks @threepointone! - feat: implementrules
config fieldThis implements the top level
rules
configuration field. It lets you specify transport rules for non-js modules. For example, you can specify*.md
files to be included as a text file with -[[rules]] {type = "Text", globs = ["**/*.md"]}
We also include a default ruleset -
{ type: "Text", globs: ["**/*.txt", "**/*.html"] }, { type: "Data", globs: ["**/*.bin"] }, { type: "CompiledWasm", globs: ["**/*.wasm"] },
More info at https://developers.cloudflare.com/workers/cli-wrangler/configuration/#build.
Known issues -
- non-wasm module types do not work in
--local
mode Data
type does not work in service worker format, in either mode
- non-wasm module types do not work in
-
#517
201a6bb
Thanks @threepointone! - fix: publish environment specific routesThis adds some tests for publishing routes, and fixes a couple of bugs with the flow.
- fixes publishing environment specific routes, closes #513
- default
workers_dev
tofalse
if there are any routes specified - catches a hanging promise when we were toggling off a
workers.dev
subdomain (which should have been caught by theno-floating-promises
lint rule, so that's concerning) - this also fixes publishing environment specific crons, but I'll write tests for that when I'm doing that feature in depth
-
#528
26f5ad2
Thanks @threepointone! - feat: top levelmain
config fieldThis implements a top level
main
field forwrangler.toml
to define an entry point for the worker , and adds a deprecation warning forbuild.upload.main
. The deprecation warning is detailed enough to give the exact line to copy-paste into your config file. Example -The `build.upload` field is deprecated. Delete the `build.upload` field, and add this to your configuration file: main = "src/chat.mjs"
This also makes
./dist
a default forbuild.upload.dir
, to match wrangler 1's behaviour.Closes #488
- #521
5947bfe
Thanks @threepointone! - chore: update esbuild from 0.14.18 to 0.14.23
-
#480
10cb789
Thanks @caass! - Refactored tail functionality in preparation for adding pretty printing.- Moved the
debug
toggle from a build-time constant to a (hidden) CLI flag - Implemented pretty-printing logs, togglable via
--format pretty
CLI option - Added stronger typing for tail event messages
- Moved the
-
#525
9d5c14d
Thanks @threepointone! - feat: tail+envsThis implements service environment support for
wrangler tail
. Fairly simple, we just generate the right URLs. wrangler tail already works for legacy envs, so there's nothing to do there.
-
#553
bc85682
Thanks @threepointone! - feat: disable tunnel inwrangler dev
Disables sharing local development server on the internet. We will bring this back after it's more polished/ready.
Fixes #550
-
#522
a283836
Thanks @threepointone! - fix: websocketsThis fixes websockets in
wrangler dev
. It looks like we broke it in #503. I've reverted the specific changes made toproxy.ts
.Test plan -
cd packages/wrangler npm run build cd ../workers-chat-demo npx wrangler dev
-
#481
8874548
Thanks @threepointone! - fix: replace the word "deploy" with "publish" everywhere.We should be consistent with the word that describes how we get a worker to the edge. The command is
publish
, so let's use that everywhere.
-
#537
b978db4
Thanks @threepointone! - feat:--local
mode only applies inwrangler dev
We'd originally planned for
--local
mode to be a thing across all wrangler commands. In hindsight, that didn't make much sense, since every command other thanwrangler dev
assumes some interaction with cloudflare and their API. The only command other than dev where this "worked" waskv
, but even that didn't make sense because wrangler dev wouldn't even read from it. We also have--experimental-enable-local-persistence
there anyway.So this moves the
--local
flag to only apply forwrangler dev
and removes any trace from other commands.
-
#518
72f035e
Thanks @threepointone! - feat: implement[text_blobs]
This implements support for
[text_blobs]
as defined by cloudflare/wrangler-legacy#1677.Text blobs can be defined in service-worker format with configuration in
wrangler.toml
as -[text_blobs] MYTEXT = "./path/to/my-text.file"
The content of the file will then be available as the global
MYTEXT
inside your code. Note that this ONLY makes sense in service-worker format workers (for now).Workers Sites now uses
[text_blobs]
internally. Previously, we were inlining the asset manifest into the worker itself, but we now attach the asset manifest to the uploaded worker. I also added an additional example of Workers Sites with a modules format worker.
-
#532
046b17d
Thanks @threepointone! - feat: dev+envsThis implements service environments +
wrangler dev
. Fairly simple, it just needed the right url when creating the edge preview token.I tested this by publishing a service under one env, adding secrets under it in the dashboard, and then trying to dev under another env, and verifying that the secrets didn't leak.
-
#552
3cee150
Thanks @petebacondarwin! - feat: add confirmation and success messages tokv:bulk delete
commandAdded the following:
- When the deletion completes, we get
Success!
logged to the console. - Before deleting, the user is now asked to confirm is that is desired.
- A new flag
--force
/-f
to avoid the confirmation check.
- When the deletion completes, we get
-
#533
1b3a5f7
Thanks @threepointone! - feat: default to legacy environmentsWhile implementing support for service environments, we unearthed a small number of usage issues. While we work those out, we should default to using regular "legacy" environments.
-
#519
93576a8
Thanks @caass! - fix: Improve port selection forwrangler dev
for both worker ports and inspector ports.Previously when running
wrangler dev
on multiple workers at the same time, you couldn't attach DevTools to both workers, since they were both listening on port 9229. With this PR, that behavior is improved -- you can now pass an--inspector-port
flag to specify a port for DevTools to connect to on a per-worker basis, or if the option is omitted, wrangler will assign a random unused port for you.This "if no option is given, assign a random unused port" behavior has also been added to
wrangler dev --port
, so runningwrangler dev
on two workers at once should now "just work". Hopefully.
-
#545
9e89dd7
Thanks @threepointone! - feat: zoned worker support forwrangler dev
This implements support for zoned workers in
wrangler dev
. Of note, since we're deprecatingzone_id
, we instead use the domain provided via--host
/config.dev.host
/--routes
/--route
/config.routes
/config.route
and infer the zone id from it.Fixes #544
- #494
6e6c30f
Thanks @caass! - - Add tests covering pretty-printing of logs inwrangler tail
- Modify
RequestEvent
types- Change
Date
types tonumber
to make parsing easier - Change
exception
andlog
message
properties tounknown
- Change
- Add datetime to pretty-printed request events
- Modify
-
#496
5a640f0
Thanks @jahands! - chore: Remove acorn/acorn-walk dependency used in Pages Functions filepath-routing.This shouldn't cause any functional changes, Pages Functions filepath-routing now uses esbuild to find exports.
-
#419
04f4332
Thanks @Electroid! - refactor: use esbuild's message formatting for cleaner error messagesThis is the first step in making a standard format for error messages. For now, this uses esbuild's error formatting, which is nice and colored, but we could decide to customize our own later. Moreover, we should use the
parseJSON
,parseTOML
, andreadFile
utilities so there are pretty errors for any configuration.
-
#501
824d8c0
Thanks @petebacondarwin! - refactor: delegate deprecatedpreview
command todev
if possibleThe
preview
command is deprecated and not supported in this version of Wrangler. Instead, one should use thedev
command for mostpreview
use-cases.This change attempts to delegate any use of
preview
todev
failing if the command line contains positional arguments that are not compatible withdev
.Resolves #9
-
#541
371e6c5
Thanks @threepointone! - chore: refactor some common code intorequireAuth()
There was a common chunk of code across most commands that ensures a user is logged in, and retrieves an account ID. I'd resisted making this into an abstraction for a while. Now that the codebase is stable, and #537 removes some surrounding code there, I made an abstraction for this common code as
requireAuth()
. This gets a mention in the changelog simply because it touches a bunch of code, although it's mostly mechanical deletion/replacement.
- #551
afd4b0e
Thanks @petebacondarwin! - fix: do not log thenull
returned fromkv:bulk put
andkv:bulk delete
-
#503
e5c7ed8
Thanks @petebacondarwin! - refact: consolidate onws
websocket libraryRemoves the
faye-websocket
library and usesws
across the code base.
-
#502
b30349a
Thanks @petebacondarwin! - fix(pages): ensure remaining args passed topages dev
command are capturedIt is common to pass additional commands to
pages dev
to generate the input source. For example:npx wrangler pages dev -- npm run dev
Previously the args after
--
were being dropped. This change ensures that these are captured and used correctly.Fixes #482
-
#512
b093df7
Thanks @threepointone! - feat: a bettertsconfig.json
This makes a better
tsconfig.json
when usingwrangler init
. Of note, it takes the defaulttsconfig.json
generated bytsc --init
, and adds our modifications.
-
#510
9534c7f
Thanks @threepointone! - feat:--legacy-env
cli arg /legacy_env
configThis is the first of a few changes to codify how we do environments in wrangler2, both older legacy style environments, and newer service environments. Here, we add a cli arg and a config field for specifying whether to enable/disable legacy style environments, and pass it on to dev/publish commands. We also fix how we were generating kv namespaces for Workers Sites, among other smaller fixes.
-
#549
3d2ce01
Thanks @petebacondarwin! - fix: kv:bulk should JSON encode its contentsThe body passed to
kv:bulk delete
andkv:bulk put
must be JSON encoded. This change fixes that and adds some tests to prove it.Fixes #547
-
#554
6e5319b
Thanks @petebacondarwin! - fix: limit bulk delete API requests to batches of 5,000The
kv:bulk delete
command now batches up delete requests in groups of 5,000, displaying progress for each request.
-
#538
4b6c973
Thanks @threepointone! - feat: withwrangler init
, create a new directory for named workersCurrently, when creating a new project, we usually first have to create a directory before running
wrangler init
, since it defaults to creating thewrangler.toml
,package.json
, etc in the current working directory. This fix introduces an enhancement, where using thewrangler init [name]
form creates a directory named[name]
and initialises the project files inside it. This matches the usage pattern a little better, and still preserves the older behaviour when we're creating a worker inside existing projects.
-
#548
e3cab74
Thanks @petebacondarwin! - refactor: clean up unnecessary async functionsThe
readFile()
andreadConfig()
helpers do not need to be async. Doing so just adds complexity to their call sites.
-
#529
9d7e946
Thanks @petebacondarwin! - feat: add more comprehensive config validation checkingThe configuration for a Worker is complicated since we can define different "environments", and each environment can have its own configuration. There is a default ("top-level") environment and then named environments that provide environment specific configuration.
This is further complicated by the fact that there are three kinds of environment configuration:
- non-overridable: these values are defined once in the top-level configuration, apply to all environments and cannot be overridden by an environment.
- inheritable: these values can be defined at the top-level but can also be overridden by environment specific values. Named environments do not need to provide their own values, in which case they inherit the value from the top-level.
- non-inheritable: these values must be explicitly defined in each environment if they are defined at the top-level. Named environments do not inherit such configuration and must provide their own values.
All configuration values in
wrangler.toml
are optional and will receive a default value if not defined.This change adds more strict interfaces for top-level
Config
andEnvironment
types, as well as validation and normalization of the optional fields that are read fromwrangler.toml
.
-
#486
ff8c9f6
Thanks @threepointone! - fix: remove warning if worker with a durable object doesn't have a nameWe were warning if you were trying to develop a durable object with an unnamed worker. Further, the internal api would actually throw if you tried to develop with a named worker if it wasn't already published. The latter is being fixed internally and should live soon, and this fix removes the warning completely.
-
#414
f30426f
Thanks @petebacondarwin! - fix: supportbuild.upload.dir
when usingbuild.upload.main
Although,
build.upload.dir
is deprecated, we should still support using it when the entry-point is being defined by thebuild.upload.main
and the format ismodules
.Fixes #413
-
#447
2c5c934
Thanks @threepointone! - fix: Config should be resolved relative to the entrypointDuring
dev
andpublish
, we should resolvewrangler.toml
starting from the entrypoint, and then working up from there. Currently, we start from the directory from which we callwrangler
, this changes that behaviour to start from the entrypoint instead.(To implement this, I made one big change: Inside commands, we now have to explicitly read configuration from a path, instead of expecting it to 'arrive' coerced into a configuration object.)
- #472
804523a
Thanks @JacobMGEvans! - bugfix: Replace.destroy()
onfaye-websockets
with.close()
added: Interface to give faye same types as compliantws
with additional.pipe()
implementation;.on("message" => fn)
-
#462
a173c80
Thanks @caass! - Add filtering to wrangler tail, so you can nowwrangler tail <name> --status ok
, for example. Supported options:--status cancelled --status error
--> you can filter onok
,error
, andcancelled
to only tail logs that have that status--header X-CUSTOM-HEADER:somevalue
--> you can filter on headers, including ones that have specific values ("somevalue"
) or just that contain any header (e.g.--header X-CUSTOM-HEADER
with no colon)--method POST --method PUT
--> filter on the HTTP method used to trigger the worker--search catch-this
--> only shows messages that contain the phrase"catch-this"
. Does not (yet!) support regular expressions--ip self --ip 192.0.2.232
--> only show logs from requests that originate from the given IP addresses."self"
will be replaced with the IP address of the computer that sent the tail request.
-
#471
21cde50
Thanks @caass! - Add tests for wrangler tail:- ensure the correct API calls are made
- ensure that filters are sent
- ensure that the correct filters are sent
- ensure that JSON gets spat out into the terminal
-
#398
40d9553
Thanks @threepointone! - feat: guess-worker-formatThis formalises the logic we use to "guess"/infer what a worker's format is - either "modules" or "service worker". Previously we were using the output of the esbuild process metafile to infer this, we now explicitly do so in a separate step (esbuild's so fast that it doesn't have any apparent performance hit, but we also do a simpler form of the build to get this information).
This also adds
--format
as a command line arg forpublish
.
-
#438
64d62be
Thanks @Electroid! - feat: Add support for "json" bindingsDid you know? We have support for "json" bindings! Here are a few examples:
[vars] text = "plain ol' string" count = 1 complex = { enabled = true, id = 123 }
- #422
ef13735
Thanks @threepointone! - chore: renameopen-in-brower.ts
toopen-in-browser.ts
-
#411
a52f0e0
Thanks @ObsidianMinor! - feat: unsafe-bindingsAdds support for "unsafe bindings", that is, bindings that aren't supported by wrangler, but are desired when uploading a Worker to Cloudflare. This allows you to use beta features before official support is added to wrangler, while also letting you migrate to proper support for the feature when desired. Note: these bindings may not work everywhere, and may break at any time.
-
#415
d826f5a
Thanks @threepointone! - fix: don't crash when browser windows don't openWe open browser windows for a few things; during
wrangler dev
, and logging in. There are environments where this doesn't work as expected (like codespaces, stackblitz, etc). This fix simply logs an error instead of breaking the flow. This is the same fix as #263, now applied to the rest of wrangler.
-
91d8994
Thanks @Mexican-Man! - fix: do not merge routes with different methods when computing pages routesFixes #92
- #474
bfedc58
Thanks @JacobMGEvans! - bugfix: createreporting.toml
file in "wrangler/config" and move error reporting user decisions to newreporting.toml
-
#445
d5935e7
Thanks @threepointone! - chore: removeexperimental_services
from configurationNow that we have
[[unsafe.bindings]]
(as of #411), we should use that for experimental features. This removes support for[experimental_services]
, and adds a helpful message for how to rewrite their configuration.This error is temporary, until the internal teams that were using this rewrite their configs. We'll remove it before GA.
What the error looks like -
Error: The "experimental_services" field is no longer supported. Instead, use [[unsafe.bindings]] to enable experimental features. Add this to your wrangler.toml: [[unsafe.bindings]] name = "SomeService" type = "service" service = "some-service" environment = "staging" [[unsafe.bindings]] name = "SomeOtherService" type = "service" service = "some-other-service" environment = "qa"
-
#456
b5f42c5
Thanks @threepointone! - chore: enablestrict
intsconfig.json
In the march towards full strictness, this enables
strict
intsconfig.json
and fixes the errors it pops up. A changeset is included because there are some subtle code changes, and we should leave a trail for them.
-
#448
b72a111
Thanks @JacobMGEvans! - feat: add--yes
with alias--y
flag as automatic answer to all prompts and runwrangler init
non-interactively. generated during setup:- package.json
- TypeScript, which includes tsconfig.json &
@cloudflare/workers-types
- Template "hello world" Worker at src/index.ts
- #403
f9fef8f
Thanks @JacobMGEvans! - feat: add scripts to package.json & autogenerate name value when initializing a project To get wrangler init projects up and running with good ergonomics for deploying and development, added default scripts "start" & "deploy" with assumed TS or JS files in generated ./src/index. The name property is now derived from user input oninit <name>
or parent directory if no input is provided.
-
#452
1cf6701
Thanks @petebacondarwin! - feat: add support for publishing workers with r2 bucket bindingsThis change adds the ability to define bindings in your
wrangler.toml
file for R2 buckets. These buckets will then be available in the environment passed to the worker at runtime.Closes #365
-
#458
a8f97e5
Thanks @petebacondarwin! - fix: do not publish to workers.dev if workers_dev is falsePreviously we always published to the workers.dev subdomain, ignoring the
workers_dev
setting in thewrangler.toml
configuration.Now we respect this configuration setting, and also disable an current workers.dev subdomain worker when we publish and
workers_dev
isfalse
.Fixes #410
-
#457
b249e6f
Thanks @threepointone! - fix: don't report intentional errorsWe shouldn't be reporting intentional errors, only exceptions. This removes reporting for all caught errors for now, until we filter all known errors, and then bring back reporting for unknown errors. We also remove a stray
console.warn()
.
- #402
5a9bb1d
Thanks @JacobMGEvans! - feat: Added Wrangler TOML fields Additional field to get projects ready to publish as soon as possible. It will check if the Worker is named, if not then it defaults to using the parent directory name.
-
#227
97e15f5
Thanks @JacobMGEvans! - feature: Sentry Integration Top level exception logging which will allow to Pre-empt issues, fix bugs faster, Identify uncommon error scenarios, and better quality error information. Context includes of Error in addition to stacktrace Environment: OS/arch node/npm versions wrangler version RewriteFrames relative pathing of stacktrace and will prevent user file system information from being sent.Sourcemaps:
- The sourcemap custom scripts for path matching in Artifact, Sentry Event and Build output is moved to be handled in GH Actions Sentry upload moved after changeset version bump script and npm script to get current version into GH env variable
- Add org and project to secrets for increased obfuscation of Cloudflare internal ecosystem
Prompt for Opt-In:
- When Error is thrown user will be prompted with yes (only sends this time), Always, and No (default). Always and No will be added to default.toml with a datetime property for future update checks.
- If the property already exists it will skip the prompt.
Sentry Tests: The tests currently check that the decision flow works as currently set up then checks if Sentry is able to send events or is disabled.
-
#427
bce731a
Thanks @petebacondarwin! - refactor: share worker bundling between bothpublish
anddev
commandsThis changes moves the code that does the esbuild bundling into a shared file and updates the
publish
anddev
to use it, rather than duplicating the behaviour.See #396 Resolves #401
-
#458
c0cfd60
Thanks @petebacondarwin! - fix: pass correct query param when uploading a scriptIn f9c1423f0c5b6008f05b9657c9b84eb6f173563a the query param was incorrectly changed from
available_on_subdomain
toavailable_on_subdomains
.
-
#432
78acd24
Thanks @threepointone! - feat: import.wasm
modules in service worker format workersThis allows importing
.wasm
modules in service worker format workers. We do this by hijacking imports to.wasm
modules, and instead registering them under[wasm_modules]
(building on the work from #409).
-
#409
f8bb523
Thanks @threepointone! - feat: support[wasm_modules]
for service-worker format workersThis lands support for
[wasm_modules]
as defined by cloudflare/wrangler-legacy#1677.wasm modules can be defined in service-worker format with configuration in wrangler.toml as -
[wasm_modules] MYWASM = "./path/to/my-wasm.wasm"
The module will then be available as the global
MYWASM
inside your code. Note that this ONLY makes sense in service-worker format workers (for now).(In the future, we MAY enable wasm module imports in service-worker format (i.e.
import MYWASM from './path/to/my-wasm.wasm'
) and global imports inside modules format workers.)
-
#423
dd9058d
Thanks @petebacondarwin! - feat: add support for managing R2 bucketsThis change introduces three new commands, which manage buckets under the current account:
r2 buckets list
: list information about all the buckets.r2 buckets create
: create a new bucket - will error if the bucket already exists.r2 buckets delete
: delete a bucket.
This brings Wrangler 2 inline with the same features in Wrangler 1.
-
#455
80aa106
Thanks @threepointone! - fix: error when entry doesn't existThis adds an error when we use an entry point that doesn't exist, either for
wrangler dev
orwrangler publish
, and either via cli arg orbuild.upload.main
inwrangler.toml
. By using a common abstraction fordev
andpublish
, This also adds support for usingbuild.config.main
/build.config.dir
forwrangler dev
.
-
#364
3575892
Thanks @threepointone! - enhance: small tweaks towrangler init
- A slightly better
package.json
- A slightly better
tsconfig.json
- installing
typescript
as a dev dependency
- A slightly better
-
#380
aacd1c2
Thanks @GregBrimble! - fix: ensure pages routes are defined correctlyIn e151223 we introduced a bug where the RouteKey was now an array rather than a simple URL string. When it got stringified into the routing object these were invalid. E.g.
[':page*', undefined]
got stringified to":page*,"
rather than":page*"
.Fixes #379
-
#329
27a1f3b
Thanks @petebacondarwin! - ci: run PR jobs on both Ubuntu, MacOS and Windows- update .gitattributes to be consistent on Windows
- update Prettier command to ignore unknown files Windows seems to be more brittle here.
- tighten up eslint config Windows seems to be more brittle here as well.
- use the matrix.os value in the cache key
Previously we were using
running.os
but this appeared not to be working.
-
#347
ede5b22
Thanks @threepointone! - fix: hidewrangler pages functions
in the main help menuThis hides
wrangler pages functions
in the main help menu, since it's only intended for internal usage right now. It still "works", so nothing changes in that regard. We'll bring this back when we have a broader story in wrangler for functions.
-
#360
f590943
Thanks @threepointone! - fix:kv:key get
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the
FetchResult
-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case forkv:key get
.Fixes #359.
-
#373
6e7baf2
Thanks @petebacondarwin! - fix: use the appropriate package manager when initializing a wrangler projectPreviously, when we initialized a project using
wrangler init
, we always used npm as the package manager.Now we check to see whether npm and yarn are actually installed, and also whether there is already a lock file in place before choosing which package manager to use.
Fixes #353
-
#363
0add2a6
Thanks @threepointone! - fix: support uppercase hotkeys inwrangler dev
Just a quick fix to accept uppercase hotkeys during
dev
.
-
#331
e151223
Thanks @petebacondarwin! - fix: generate valid URL route paths for pages on WindowsPreviously route paths were manipulated by file-system path utilities. On Windows this resulted in URLs that had backslashes, which are invalid for such URLs.
Fixes #51 Closes #235 Closes #330 Closes #327
-
#338
e0d2f35
Thanks @threepointone! - feat: environments for Worker SitesThis adds environments support for Workers Sites. Very simply, it uses a separate kv namespace that's indexed by the environment name. This PR also changes the name of the kv namespace generated to match wrangler 1's implementation.
-
#329
e1d2198
Thanks @petebacondarwin! - test: support testing in CI on Windows-
Don't rely on bash variables to configure tests The use of bash variables in the
npm test
script is not supported in Windows Powershell, causing CI on Windows to fail. These bash variables are used to override the API token and the Account ID.This change moves the control of mocking these two concepts into the test code, by adding
mockAccountId()
andmockApiToken()
helpers.- The result is slightly more boilerplate in tests that need to avoid hitting the auth APIs.
- But there are other tests that had to revert these environment variables. So the boilerplate is reduced there.
-
Sanitize command line for snapshot tests This change applies
normalizeSlashes()
andtrimTimings()
to command line outputs and error messages to avoid inconsistencies in snapshots. The benefit here is that authors do not need to keep adding them to all their snapshot tests. -
Move all the helper functions into their own directory to keep the test directory cleaner.
-
- #380
aacd1c2
Thanks @GregBrimble! - refactor: clean up pages routing
-
#343
cfd8ba5
Thanks @threepointone! - chore: update esbuildUpdate esbuild to 0.14.14. Also had to change
import esbuild from "esbuild";
toimport * as esbuild from "esbuild";
indev.tsx
.
-
#371
85ceb84
Thanks @nrgnrg! - fix: pages advanced mode usagePreviously in pages projects using advanced mode (a single
_worker.js
or--script-path
file rather than a./functions
folder), callingpages dev
would quit without an error and not launch miniflare.This change fixes that and enables
pages dev
to be used with pages projects in advanced mode.
-
#383
969c887
Thanks @threepointone! - fix: remove redundant process.cwd() calls inwrangler init
Followup from #372 (comment), just removing some unnecessary calls to
process.cwd()
/path.join()
, since they're already relative to where they're called from.
-
#329
ac168f4
Thanks @petebacondarwin! - refactor: use helpers to manage npm commandsThis change speeds up tests and avoids us checking that npm did what it is supposed to do.
-
#348
b8e3b01
Thanks @threepointone! - chore: replacenode-fetch
withundici
There are several reasons to replace
node-fetch
withundici
:undici
'sfetch()
implementation is set to become node's standardfetch()
implementation, which means we can just remove the dependency in the future (or optionally load it depending on which version of node is being used)node-fetch
pollutes the global type space with a number of standard types- we already bundle
undici
viaminiflare
/pages, so this means our bundle size could ostensibly become smaller.
This replaces
node-fetch
withundici
.- All instances of
import fetch from "node-fetch"
are replaced withimport {fetch} from "undici"
undici
also comes with spec compliant forms ofFormData
andFile
, so we could also removeformdata-node
inform_data.ts
- All the global types that were injected by
node-fetch
are now imported fromundici
(as well as some mistaken ones fromnode:url
) - NOTE: this also turns on
skipLibCheck
intsconfig.json
. Some dependencies oddly depend on browser globals likeRequest
,Response
(like@miniflare/core
,jest-fetch-mock
, etc), which now fail becausenode-fetch
isn't injecting those globals anymore. So we enableskipLibCheck
to bypass them. (I'd thoughtskipLibCheck
completely ignores 'third party' types, but that's not true - it still uses the module graph to scan types. So we're still typesafe. We should enablestrict
sometime to avoidany
s, but that's for later.) - The bundle size isn't smaller because we're bundling 2 different versions of
undici
, but we'll fix that by separately upping the version ofundici
that miniflare bundles.
-
#357
41cfbc3
Thanks @threepointone! - chore: add eslint-plugin-import- This adds
eslint-plugin-import
to enforce ordering of imports, and configuration for the same inpackage.json
. - I also run
npm run check:lint -- --fix
to apply the configured order in our whole codebase. - This also needs a setting in
.vscode/settings.json
to prevent spurious warnings inside vscode. You'll probably have to restart your IDE for this to take effect. (re: import-js/eslint-plugin-import#2377 (comment))
(I'd also like to enforce using
node:
prefixes for node builtin modules, but that can happen later. For now I manually added the prefixes wherever they were missing. It's not functionally any different, but imo it helps the visual grouping.) - This adds
-
#372
05dbb0d
Thanks @threepointone! - feat:wrangler init
offers to create a starter workerWe got feedback that
wrangler init
felt incomplete, because the immediate next thing folks need is a starter source file. So this adds another step towrangler init
where we offer to create that file for you.Fixes #355
-
#384
8452485
Thanks @petebacondarwin! - refactor: use xxhash-wasm for better compatibility with WindowsThe previous xxhash package we were using required a build step, which relied upon tooling that was not always available on Window.
This version is a portable WASM package.
-
#334
536c7e5
Thanks @threepointone! - feat: wasm support for local mode inwrangler dev
This adds support for
*.wasm
modules into local mode forwrangler dev
.In 'edge' mode, we create a javascript bundle, but wasm modules are uploaded to the preview server directly when making the worker definition form upload. However, in 'local' mode, we need to have the actual modules available to the bundle. So we copy the files over to the bundle path. We also pass appropriate
--modules-rule
directive tominiflare
.I also added a sample wasm app to use for testing, created from a default
workers-rs
project.Fixes #299
-
#329
b8a3e78
Thanks @petebacondarwin! - ci: usenpm ci
and do not cache workspace packages in node_modulesPreviously we were caching all the
node_modules
files in the CI jobs and then runningnpm install
. While this resulted in slightly improved install times on Ubuntu, it breaks on Windows because the npm workspace setup adds symlinks into node_modules, which the Github cache action cannot cope with.This change removes the
node_modules
caches (saving some time by not needing to restore them) and replacesnpm install
withnpm ci
.The
npm ci
command is actually designed to be used in CI jobs as it only installs the exact versions specified in thepackage-lock.json
file, guaranteeing that for any commit we always have exactly the same CI job run, deterministically.It turns out that, on Ubuntu, using
npm ci
makes very little difference to the installation time (~30 secs), especially if there is nonode_modules
there in the first place.Unfortunately, MacOS is slower (~1 min), and Windows even worse (~2 mins)! But it is worth this longer CI run to be sure we have things working on all OSes.
-
#333
6320a32
Thanks @threepointone! - fix: pass worker name to syncAssets indev
This fix passes the correct worker name to
syncAssets
duringwrangler dev
. This function uses the name to create the backing kv store for a Workers Sites definition, so it's important we get the name right.I also fixed the lint warning introduced in #321, to pass
props.enableLocalPersistence
as a dependency in theuseEffect
call that starts the "local" mode dev server.
-
#335
a417cb0
Thanks @threepointone! - fix: prevent infinite loop when fetching a list of resultsWhen fetching a list of results from cloudflare APIs (e.g. when fetching a list of keys in a kv namespace), the api returns a
cursor
that a consumer should use to get the next 'page' of results. It appears this cursor can also be a blank string (while we'd only account for it to beundefined
). By only accounting for it to beundefined
, we were infinitely looping through the same page of results and never terminating. This PR fixes it by letting it be a blank string (andnull
, for good measure)
-
#332
a2155c1
Thanks @threepointone! - fix: wait for port to be available before creating a dev serverWhen we run
wrangler dev
, we start a server on a port (defaulting to 8787). We do this separately for both local and edge modes. However, when switching between the two with thel
hotkey, we don't 'wait' for the previous server to stop before starting the next one. This can crash the process, and we don't want that (of course). So we introduce a helper functionwaitForPortToBeAvailable()
that waits for a port to be available before returning. This is used in both the local and edge modes, and prevents the bug right now, where switching between edge - local - edge crashes the process.(This isn't a complete fix, and we can still cause errors by very rapidly switching between the two modes. A proper long term fix for the future would probably be to hoist the proxy server hook above the
<Remote/>
and<Local/>
components, and use a single instance throughout. But that requires a deeper refactor, and isn't critical at the moment.)
-
#336
ce61000
Thanks @threepointone! - feat: inline text-like files into the worker bundleWe were adding text-like modules (i.e.
.txt
,.html
and.pem
files) as separate modules in the Worker definition, but this only really 'works' with the ES module Worker format. This commit changes that to inline the text-like files into the Worker bundle directly.We still have to do something similar with
.wasm
modules, but that requires a different fix, and we'll do so in a subsequent commit.
-
#336
ce61000
Thanks @threepointone! - feat: Sites support for local modewrangler dev
This adds support for Workers Sites in local mode when running wrangler
dev
. Further, it fixes a bug where we were sending the__STATIC_CONTENT_MANIFEST
definition as a separate module even with service worker format, and a bug where we weren't uploading the namespace binding when other kv namespaces weren't present.
-
#307
53c6318
Thanks @threepointone! - feat:wrangler secret * --local
This PR implements
wrangler secret
for--local
mode. The implementation is simply a no-op, since we don't want to actually write secret values to disk (I think?). I also got the messaging for remote mode right by copying from wrangler 1. Further, I added tests for all thewrangler secret
commands.
- #324
b816333
Thanks @GregBrimble! - Fixeswrangler pages dev
failing to start for just a folder of static assets (no functions)
-
#317
d6ef61a
Thanks @threepointone! - fix: restart thedev
proxy server whenever it closesWhen we run
wrangler dev
, the session that we setup with the preview endpoint doesn't last forever, it dies after ignoring it for 5-15 minutes or so. The fix for this is to simply reconnect the server. So we use a state hook as a sigil, and add it to the dependency array of the effect that sets up the server, and simply change it every time the server closes.Fixes #197
(In wrangler1, we used to restart the whole process, including uploading the worker again, making a new preview token, and so on. It looks like that they may not have been necessary.)
-
#312
77aa324
Thanks @threepointone! - fix: remove--prefer-offline
when runningnpm install
We were using
--prefer-offline
when runningnpm install
duringwrangler init
. The behaviour is odd, it doesn't seem to fetch from the remote when the cache isn't hit, which is not what I'm expecting. So we remove--prefer-offline
.
-
#311
a5537f1
Thanks @threepointone! - fix: custom builds should allow multiple commandsWe were running custom builds as a regular command with
execa
. This would fail whenever we tried to run compound commands likecargo install -q worker-build && worker-build --release
(via #236). The fix is to useshell: true
, so that the command is run in a shell and can thus use bash-y syntax like&&
, and so on. I also switched to usingexecaCommand
which splits a command string into parts correctly by itself.
-
#321
5b64a59
Thanks @geelen! - fix: disable local persistence by default & add--experimental-enable-local-persistence
flagBREAKING CHANGE:
When running
dev
locally any data stored in KV, Durable Objects or the cache are no longer persisted between sessions by default.To turn this back on add the
--experimental-enable-local-persistence
at the command line.
-
#293
71b0fab
Thanks @petebacondarwin! - fix: warn if thesite.entry-point
configuration is found during publishingAlso updates the message and adds a test for the error when there is no entry-point specified.
Fixes #282
-
#304
7477b52
Thanks @threepointone! - feat: enhancewrangler init
This PR adds some enhancements/fixes to the
wrangler init
command.- doesn't overwrite
wrangler.toml
if it already exists - installs
wrangler
when creatingpackage.json
- offers to install
wrangler
intopackage.json
even ifpackage.json
already exists - offers to install
@cloudflare/workers-types
even iftsconfig.json
already exists - pipes stdio back to the terminal so there's feedback when it's installing npm packages
This does have the side effect of making out tests slower. I added
--prefer-offline
to thenpm install
calls to make this a shade quicker, but I can't figure out a good way of mocking these. I'll think about it some more later. We should work on making the installs themselves quicker (re: #66)This PR also fixes a bug with our tests -
runWrangler
would catch thrown errors, and if we didn't manually verify the error, tests would pass. Instead, it now throws correctly, and I modified all the tests to assert on thrown errors. It seems like a lot, but it was just mechanical rewriting. - doesn't overwrite
-
#294
7746fba
Thanks @threepointone! - feature: add more types that get logged viaconsole
methodsThis PR adds more special logic for some data types that get logged via
console
methods. Types likePromise
,Date
,WeakMaps
, and some more, now get logged correctly (or at least, better than they used to).This PR also fixes a sinister bug - the
type
of theConsoleAPICalled
events don't match 1:1 with actual console methods (eg:console.warn
message type iswarning
). This PR adds a mapping between those types and method names. Some methods don't seem to have a message type, I'm not sure why, but we'll get to them later.
-
#310
52c99ee
Thanks @threepointone! - feat: error if a site definition doesn't have abucket
fieldThis adds an assertion error for making sure a
[site]
definition always has abucket
field.As a cleanup, I made some small fixes to theConfig
type definition, and modified the tests inpublish.test.ts
to use the config format when creating awrangler.toml
file.
-
#292
e5d3690
Thanks @threepointone! - fix: use entrypoint specified in esbuuild's metafile as source for building the workerWhen we pass a non-js file as entry to esbuild, it generates a
.js
file. (which, is the whole job of esbuild, haha). So, given<source>/index.ts
, it'll generate<destination>/index.js
. However, when we try to 'find' the matching file to pass on as an input to creating the actual worker, we try to use the original file name inside the destination directory. At this point, the extension has changed, so it doesn't find the file, and hence we get the error that looks likeENOENT: no such file or directory, open '/var/folders/3f/fwp6mt7n13bfnkd5vl3jmh1w0000gp/T/tmp-61545-4Y5kwyNI8DGU/src/worker.ts'
The actual path to the destination file is actually the key of the block in
metafile.outputs
that matches the given output.entryPoint, so this PR simply rewrites the logic to use that instead.
-
#287
b63efe6
Thanks @threepointone! - fix: propagate api errors to the terminal correctlyAny errors embedded in the response from the Cloudflare API were being lost, because
fetchInternal()
would throw on a non-200 response. This PR fixes that behaviour:- It doesn't throw on non-200 responses
- It first gets the response text with
.text()
and converts it to an object withJSON.parse
, so in case the api returns a non json response, we don't lose response we were sent.
Unfortunately, because of the nature of this abstraction, we do lose the response
status
code andstatusText
, but maybe that's acceptable since we have richer error information in the payload. I considered logging the code and text to the terminal, but that may make it noisy.
- #242
014a731
Thanks @petebacondarwin! - Refactor pages code to pass strict-null checks
-
#267
e22f9d7
Thanks @petebacondarwin! - refactor: tidy up the typings of the build result in devIn #262 some of the strict null fixes were removed to resolve a regression. This refactor re-applies these fixes in a way that avoids that problem.
- #284
20377e8
Thanks @petebacondarwin! - Add whoami command
- #270
2453577
Thanks @petebacondarwin! - feat: add support for include and exclude when publishing site assets
-
#270
0289882
Thanks @petebacondarwin! - fix: ensurekv:key list
matches the output from Wrangler 1The previous output was passing an array of objects to console.log, which ended up showing something like
[Object object] [Object object] ...
Now the result is JSON stringified before being sent to the console. The tests have been fixed to check this too.
-
#258
f9c1423
Thanks @petebacondarwin! - fix: correctly handle entry-point path when publishingThe
publish
command was failing when the entry-point was specified in the wrangler.toml file and the entry-point imported another file.This was because we were using the
metafile.inputs
to guess the entry-point file path. But the order in which the source-files were added to this object was not well defined, and so we could end up failing to find a match.This fix avoids this by using the fact that the
metadata.outputs
object will only contain one element that has theentrypoint
property - and then using that as the entry-point path. For runtime safety, we now assert that there cannot be zero or multiple such elements.
-
#275
e9ab55a
Thanks @petebacondarwin! - feat: add a link to create a github issue when there is an error.When a (non-yargs) error surfaces to the top level, we know also show a link to Github to encourage the developer to report an issue.
-
#286
b661dd0
Thanks @dependabot! - chore: Updatenode-fetch
to 3.1.1, runnpm audit fix
in rootThis commit addresses a secutity issue in
node-fetch
and updates it to 3.1.1. I also rannpm audit fix
in the root directory to address a similar issue with@changesets/get-github-info
.
-
#249
9769bc3
Thanks @petebacondarwin! - Do not crash when processing environment configuration.Previously there were corner cases where the configuration might just crash. These are now handled more cleanly with more appropriate warnings.
-
#272
5fcef05
Thanks @petebacondarwin! - refactor: enable TypeScript strict-null checksThe codebase is now strict-null compliant and the CI checks will fail if a PR tries to introduce code that is not.
-
#277
6cc9dde
Thanks @petebacondarwin! - fix: align publishing sites asset keys with Wrangler 1- Use the same hashing strategy for asset keys (xxhash64)
- Include the full path (from cwd) in the asset key
- Match include and exclude patterns against full path (from cwd)
- Validate that the asset key is not over 512 bytes long
-
#270
522d1a6
Thanks @petebacondarwin! - fix: check actual asset file size, not base64 encoded sizePreviously we were checking whether the base64 encoded size of an asset was too large (>25MiB). But base64 takes up more space than a normal file, so this was too aggressive.
- #263
402c77d
Thanks @jkriss! - fix: appropriately fail silently when the open browser command doesn't work
-
#280
f19dde1
Thanks @petebacondarwin! - fix: skip unwanted files and directories when publishing site assetsIn keeping with Wrangler 1, we now skip node_modules and hidden files and directories.
An exception is made for
.well-known
. See https://datatracker.ietf.org/doc/html/rfc8615.The tests also prove that the asset uploader will walk directories in general.
-
#258
ba6fc9c
Thanks @petebacondarwin! - chore: add test-watch script to the wrangler workspaceWatch the files in the wrangler workspace, and run the tests when anything changes:
> npm run test-watch -w wrangler
This will also run all the tests in a single process (rather than in parallel shards) and will increase the test-timeout to 50 seconds, which is helpful when debugging.
- #243
dc7ce83
Thanks @petebacondarwin! - refactor: update test code to pass strict-null checks
- #244
2e7a75f
Thanks @petebacondarwin! - refactor: update dev and publish commands to pass strict-null checks
-
#238
65f9904
Thanks @threepointone! - refactor: simplify and documentconfig.ts
This PR cleans up the type definition for the configuration object, as well as commenting the hell out of it. There are no duplicate definitions, and I annotated what I could.
@optional
means providing a value isn't mandatory@deprecated
means the field itself isn't necessary anymore in wrangler.toml@breaking
means the deprecation/optionality is a breaking change from wrangler 1@todo
means there's more work to be done (with details attached)@inherited
means the field is copied to all environments
- #247
edc4b53
Thanks @petebacondarwin! - refactor: update miscellaneous source files to pass strict-null checks
- #248
5806932
Thanks @petebacondarwin! - refactor: update proxy code to pass strict-null checks
- #241
5d423e9
Thanks @petebacondarwin! - chore: add common words to the cSpell config to prevent unwanted warnings
-
#257
00e51cd
Thanks @threepointone! - fix: description forkv:bulk delete <filename>
The description for the
kv:bulk delete
command was wrong, it was probably copied earlier from thekv:bulk put
command. This PR fixes the mistake.
-
#262
7494cf7
Thanks @threepointone! - fix: fixdev
andpublish
We introduced some bugs in recent PRs
- In #196, we broke being able to pass an entrypoint directly to the cli. In this PR, I just reverted that fix. I'll reopen #78 and we'll tackle it again later. (cc @jgentes)
- In #215, we broke being able to publish a script by just passing
--latest
or--compatibility-data
in the cli. This PR fixes that by reading the correct argument when choosing whether to publish. - In #247, we broke how we made requests by passing headers to requests. This PR reverts the changes made in
cfetch/internal.ts
. (cc @petebacondarwin) - In #244, we broke
dev
and it would immediately crash. This PR fixes the reference indev.tsx
that was breaking. (cc @petebacondarwin)
- #250
3c74a4a
Thanks @petebacondarwin! - refactor: update inspector code to ensure that strict-null types pass
-
#231
18f8f65
Thanks @threepointone! - refactor: proxy/preview serverThis PR refactors how we setup the proxy server between the developer and the edge preview service during
wrangler dev
. Of note, we start the server immediately. We also buffer requests/streams and hold on to them, when starting/refreshing the token. This means a developer should never seeERR_CONNECTION_REFUSED
error page, or have an older worker respond after making a change to the code. And when the token does get refreshed, we flush said streams/requests with the newer values, making the iteration process a lot smoother and predictable.
- #239
0431093
Thanks @Warfields! - Added prompt for users to select an account.
- #225
b901bf7
Thanks @GregBrimble! - Fix the--watch
command forwrangler pages functions build
.
-
#208
fe4b099
Thanks @petebacondarwin! - Remove explicitany
types from the codebaseThis change removes all use of
any
from the code and updates theno-explicit-any
eslint rule to be an error.
- #223
a979d55
Thanks @GregBrimble! - Add ability to compile a directory other thanfunctions
forwrangler pages functions build
.
- #216
e1c615f
Thanks @GregBrimble! - Ignore non-JS files when compiling Pages Functions
- #217
777f4d5
Thanks @GregBrimble! - Reverse execution order of Pages Functions middlewares
- #196
fc112d7
Thanks @jgentes! - allow specifying only "index" without extension or nothing at all for "wrangler dev" and "wrangler publish"
- #211
3bbfd4f
Thanks @GregBrimble! - Silently fail to auto-open the browser inwrangler pages dev
command when that errors out.
-
#189
2f7e1b2
Thanks @petebacondarwin! - Refactor raw value extraction from Cloudflare APIsMost API responses are JSON of the form:
{ result, success, errors, messages, result_info }
where the
result
contains the actual response value.But some API responses only contain the result value.
This change refactors the client-side fetch API to allow callers to specify what kind of response they expect.
- #202
e26781f
Thanks @threepointone! - Disable @typescript-lint/no-explicit-any eslint rule in pages code
- #214
79d0f2d
Thanks @threepointone! - rename--public
as--experimental-public
-
#215
41d4c3e
Thanks @threepointone! - Add--compatibility-date
,--compatibility-flags
,--latest
cli arguments todev
andpublish
.- A cli arg for adding a compatibility data, e.g
--compatibility_date 2022-01-05
- A shorthand
--latest
that setscompatibility_date
to today's date. Usage of this flag logs a warning. latest
is NOT a config field inwrangler.toml
.- In
dev
, when a compatibility date is not available in eitherwrangler.toml
or as a cli arg, then we default to--latest
. - In
publish
we error if a compatibility date is not available in eitherwrangler.toml
or as a cli arg. Usage of--latest
logs a warning. - We also accept compatibility flags via the cli, e.g:
--compatibility-flags formdata_parser_supports_files
- A cli arg for adding a compatibility data, e.g
-
#210
d381fed
Thanks @GregBrimble! - Exposewrangler pages functions build
command, which takes thefunctions
folder and compiles it into a single Worker.This was already done in
wrangler pages dev
, so this change just exposes this build command for use in our build image, or for people who want to do it themselves.
-
#213
5e1222a
Thanks @GregBrimble! - Adds support for building a Worker from a folder of functions which isn't tied to the Pages platform.This lets developers use the same file-based routing system an simplified syntax when developing their own Workers!
-
#199
d9ecb70
Thanks @threepointone! - Refactor inspection/debugging code -- I've installed devtools-protocol, a convenient package that has the static types for the devtools protocol (duh) autogenerated from chrome's devtools codebase.
- We now log messages and exceptions into the terminal directly, so you don't have to open devtools to see those messages.
- Messages are now buffered until a devtools instance connects, so you won't lose any messages while devtools isn't connected.
- We don't lose the connection on making changes to the worker, removing the need for the kludgy hack on the devtools side (where we refresh the whole page when there's a change)
-
#189
2f7e1b2
Thanks @petebacondarwin! - Fix pagination handling of list requests to the Cloudflare APIWhen doing a list request to the API, the server may respond with only a single page of results. In this case, it will also provide a
cursor
value in theresult_info
part of the response, which can be used to request the next page. This change implements this on the client-side so that we get all the results by requesting further pages when there is a cursor.
- #220
6fc2276
Thanks @GregBrimble! - Add--live-reload
option towrangler pages dev
which automatically reloads HTML pages when a change is detected
- #223
a979d55
Thanks @GregBrimble! - Add--output-config-path
option towrangler pages functions build
which writes a config file describing thefunctions
folder.
-
1fdcfe3: Subfolder Relative Pathing Fix issue #147 The filename from args didn't handle relative paths passed in from users with scripts in subfolders. To handle the subfolder pathing a path.relative using cwd() to user input filepath to the filepath variable passed into Dev
-
0330ecf: Adds the Content-Type header when serving assets with
wrangler pages dev
. It guesses the mime-type based on the asset's file extension. -
eaf40e8: Improve the error message for bad
kv:namespace delete
commands -
562d3ad: chore: enable eslint's no-shadow rule
-
9cef492: Adds the logic of @cloudflare/pages-functions-compiler directly into wrangler. This generates a Worker from a folder of functions.
Also adds support for sourcemaps and automatically watching dependents to trigger a re-build.
-
3426c13: fix: prevent
useWorker
's inifinite restarts duringdev
-
e9a1820: Upgrade
miniflare
to2.0.0-rc.5
-
7156e39: Pass bindings correctly to miniflare/child_process.spawn in
dev
, to prevent miniflare from erroring out on startup -
ce2d7d1: Add experimental support for worker-to-worker service bindings. This introduces a new field in configuration
experimental_services
, and serialises it when creating and uploading a worker definition. This is highly experimental, and doesn't work withwrangler dev
yet. -
072566f: Fixed KV getNamespaceId preview flag bug
-
5856807: Improve validation message for
kv:namespace create
Previously, if the user passed multiple positional arguments (which is invalid) the error message would suggest that these should be grouped in quotes. But this is also wrong, since a namespace binding name must not contain spaces.
-
34ad323: Refactor the way we convert configurations for bindings all the way through to the API where we upload a worker definition. This commit preserves the configuration structure (mostly) until the point we serialise it for the API. This prevents the way we use duck typing to detect a binding type when uploading, makes the types a bit simpler, and makes it easier to add other types of bindings in the future (notably, the upcoming service bindings.)
- 421f2e4: Update base version to 0.0.5, copy the README to packages/wrangler
-
cea27fe: don't log file contents when writing via
kv:key put <key> --path <path>
-
b53cbc8: CI/CD
- Release flow triggered on PR's closed
-
43e7a82: When using
wrangler pages dev
, enable source maps and log unhandled rejections -
c716abc: Error and exit if the
--type
option is used for theinit
command.The
--type
option is no longer needed, nor supported.The type of a project is implicitly javascript, even if it includes a wasm (e.g. built from rust).
Projects that would have had the
webpack
type need to be configured separately to have a custom build. -
3752acf: Add support for websockets in
dev
, i.e. when developing workers. This replaces the proxy layer that we use to connect to the 'edge' during preview mode, using thefaye-wesocket
library. -
c7bee70: Patches typing mismatches between us, undici and miniflare when proxying requests in pages dev, and also adds fallback 404 behavior which was missed
-
8b6c2d1: Add more fields to the
tsconfig.json
generated bywrangler init
-
78cd080: Custom builds for
dev
andpublish
-
cd05d20: import text file types into workers
-
1216fc9: Export regular functions from dialog.ts, pass tests (followup from #124)
-
6fc4c50: Display error message when unknown command is provided to the wrangler CLI.
-
23543fe: Allow the developer to exit
init
if there is already a toml file -
1df6b0c: enable @typescript-eslint/no-floating-promises, pass lint+type check
-
3c5725f: CI/CD Cleanup
- Removed the build step from tests, which should speed up the "Tests" Workflow.
- Added a branch specific trigger for "Release", now the Workflow for "Release" should only work on PRs closed to
main
- Removed the "Changeset PR" Workflow. Now the "Release" Workflow will handle everything needed for Changesets.
-
fb0eae7: support importing
.wasm
files /workers-rs
support -
e928f94: Improve support for package exports conditionals, including "worker" condition
-
43e7a82: Upgrade
miniflare
to2.0.0-rc.4
-
f473942: Replaces the static asset server with a more faithful simulation of what happens with a production Pages project.
Also improves error handling and automatically opens the browser when running
wrangler pages dev
.
-
689cd55: CI/CD Improvements
Adding configuration allows for use of CLI for changesets. A necessary supplement to the changesets bot, and GitHub Action.
- Installed Changeset CLI tool
- NPX changeset init
- Added changesets directory
- Config
- README
- Modified the config for
main
branch instead ofmaster
Running Prettier as a rule through ESLint to improve CI/CD usage
- Added additional TypeScript support for ESLint
- Prettier errors as ESLint rule
- .vscode directory w/ settings.json config added that enforces the usage of ESLint by anyone working in the workspace
-
b0fcc7d: CI/CD Tests & Type Checking GH Workflow additions:
- Added Testing script
- Added Linting script
- tsc is using skipLibCheck as a current workaround
- TODO added for future removal
- Runs on every Pull Request instance
- Removed npm ci in favor of npm install
- Removed --prefer-offline in favor of local cache artifact
-
2f760f5: remove
--polyfill-node
-
fd53780:
kv:key put
: make only one ofvalue
or--path <path>
necessary -
dc41476: Added optional shortcuts
-
7858ca2: Removed NPM registry and timeout from CI
-
85b5020: Make
wrangler dev
work with durable objects