Releases: cloudflare/workers-sdk
[email protected]
Patch Changes
-
#2172
47a142af
Thanks @KianNH! - Validate object size for wrangler r2 put -
#2161
dff756f3
Thanks @jbw1991! - Check for the correct API error code when attempting to detect missing Queues. -
#2165
a26f74ba
Thanks @JacobMGEvans! - Fix Var string type:
The type was not being coerced to a string, so TypeScript considered it a unresolved type.
[email protected]
Patch Changes
-
#2067
758419ed
Thanks @Skye-31! - fix: Accurately determine when using imports in _worker.js for Advanced Mode Pages Functions -
#2159
c5a7557f
Thanks @rozenmd! - fix: silence the 10023 error that throws when deployments isn't fully rolled out -
#2067
758419ed
Thanks @Skye-31! - fix: D1 support for Pages Functions -
#2067
758419ed
Thanks @Skye-31! - chore: Refactor Pages Functions bundling
[email protected]
Minor Changes
-
#2107
511943e9
Thanks @celso! - fix: D1 execute and backup commands improvements- Better and faster handling when importing big SQL files using execute --file
- Increased visibility during imports, sends output with each batch API call
- Backups are now downloaded to the directory where wrangler was initiated from
-
#2130
68f4fa6f
Thanks @matthewdavidrodgers! - feature: Add warnings around bundle sizes for large scriptsPrints a warning for scripts > 1MB compressed, encouraging smaller
script sizes. This warning can be silenced by setting the
NO_SCRIPT_SIZE_WARNING env variableIf a publish fails with either a script size error or a validator error
on script startup (CPU or memory), we print out the largest 5
dependencies in your bundle. This is accomplished by using the esbuild
generated metafile. -
#2064
49b6a484
Thanks @jbw1991! - Adds support for Cloudflare Queues. Adds new CLI commands to configure Queues. Queue producers and consumers can be defined in wrangler.toml. -
#1982
5640fe88
Thanks @penalosa! - Enable support forwrangler dev
on Workers behind Cloudflare Access, utilisingcloudflared
. If you don't havecloudflared
installed, Wrangler will prompt you to install it. If you do, then the first time you start developing usingwrangler dev
your default browser will open with a Cloudflare Access prompt.
Patch Changes
-
#2134
b164e2d6
Thanks @jspspike! - Added current version to publish output -
#2127
0e561e83
Thanks @JacobMGEvans! - Fix: Missing Worker name using--from-dash
Added the--from-dash
name as a fallback when no name is provided in thewrangler init
command.
Additionally added a checks to thestd.out
to ensure that the name is provided.resolves #1853
-
#2073
1987a79d
Thanks @mrbbot! - If--env <env>
is specified, we'll now check.env.<env>
/.dev.vars.<env>
first.
If they don't exist, we'll fallback to.env
/.dev.vars
. -
#2072
06aa6121
Thanks @mrbbot! - Fixed importing installed npm packages with the same name as Node built-in
modules ifnode_compat
is disabled. -
#2124
02ca556c
Thanks @JacobMGEvans! - Computing the name from binding response
Now thevars
will be computed, example:
[var.binding.name]: var.binding.text
this will resolve the issue that was occurring with
generating a TOML with incorrect fields for thevars
key/value pair.resolves #2048
@cloudflare/[email protected]
Patch Changes
- #2146
c987fceb
Thanks @GregBrimble! - feat: Add afailOpen
prop to the deployment metadata.
[email protected]
Patch Changes
-
#2103
f1fd62a1
Thanks @GregBrimble! - fix: Don't uploadfunctions/
directory as part ofwrangler pages publish
If the root directory of a project was the same as the build output directory, we were previously uploading the
functions/
directory as static assets. This PR now ensures that thefunctions/
files are only used to create Pages Functions and are no longer uploaded as static assets.Additionally, we also now do upload
_worker.js
,_headers
,_redirects
and_routes.json
if they aren't immediate children of the build output directory. Previously, we'd ignore all files with this name regardless of location. For example, if you have apublic/blog/how-to-use-pages/_headers
file (wherepublic
is your build output directory), we will now upload the_headers
file as a static asset. -
#2111
ab52f771
Thanks @GregBrimble! - feat: Add apassThroughOnException()
handler in Pages FunctionsThis
passThroughOnException()
handler is not as good as the built-in for Workers. We're just adding it now as a stop-gap until we can do the behind-the-scenes plumbing required to make the built-in function work properly.We wrap your Pages Functions code in a
try/catch
and on failure, if you callpassThroughOnException()
we defer to the static assets of your project.For example:
export const onRequest = ({ passThroughOnException }) => { passThroughOnException(); x; // Would ordinarily throw an error, but instead, static assets are served. };
-
#2117
aa08ff7c
Thanks @nprogers! - Added error logging for pages upload
[email protected]
Patch Changes
-
#2074
b08ab1e5
Thanks @JacobMGEvans! - The type command aggregates bindings and custom module rules from config, then generates a DTS file for both service workers'declare global { ... }
or module workers'interface Env { ... }
Custom module rules generate
declare module
s based on the module type (Text
,Data
orCompiledWasm
).
Module Example Outputs:CompiledWasm
declare module "**/*.wasm" { const value: WebAssembly.Module; export default value; }
Data
declare module "**/*.webp" { const value: ArrayBuffer; export default value; }
Text
declare module "**/*.text" { const value: string; export default value; }
-
#2065
14c44588
Thanks @CarmenPopoviciu! - fix(pages):wrangler pages dev
matches routing rules in_routes.json
too looselyCurrently, the logic by which we transform routing rules in
_routes.json
to
regular expressions, so we can performpathname
matching & routing when we
runwrangler pages dev
, is too permissive, and leads to serving incorrect
assets for certain url paths.For example, a routing rule such as
/foo
will incorrectly match pathname
/bar/foo
. Similarly, pathname/foo
will be incorrectly matched by the
/
routing rule.
This commit fixes our routing rule to pathname matching logic and brings
wrangler pages dev
on par with routing in deployed Pages projects. -
#2098
2a81caee
Thanks @threepointone! - feat: delete site/assets namespace when a worker is deletedThis patch deletes any site/asset kv namespaces associated with a worker when
wrangler delete
is used. It finds the namespace associated with a worker by using the names it would have otherwise used, and deletes it. It also does the same for the preview namespace that's used withwrangler dev
. -
#2091
9491d86f
Thanks @JacobMGEvans! - Wrangler deployments command
Added support for the deployments command, which allows you to list the last ten deployments for a given script.The information will include:
- Version ID
- Version number
- Author email
- Latest deploy
- Created on
resolves #2089
-
#2068
2c1fd9d2
Thanks @mrbbot! - Fixed issue where information and warning messages from Miniflare were being
discarded when usingwrangler dev --local
. Logs from Miniflare will now be
coloured too, if the terminal supports this.
[email protected]
Patch Changes
-
#2049
903b55d1
Thanks @rozenmd! - fix: add missinglocal
argument to unstable_dev's DevOptions -
#2026
7d987ee2
Thanks @GregBrimble! - fix: Default to today's compatibility date inwrangler pages dev
Like
wrangler dev
proper,wrangler pages dev
now defaults to using today's compatibility date.
It can be overriden with--compatibility-date=YYYY-MM-DD
.https://developers.cloudflare.com/workers/platform/compatibility-dates/
-
#2035
76a66fc2
Thanks @penalosa! - Warn when opening a tail on workers for which a restart could be disruptive (i.e. Workers which use Durable Objects in conjunction with WebSockets) -
#2045
c2d3286f
Thanks @threepointone! - feat: implement a basicwrangler delete
This PR adds a simple (but useful!) implementation for
wrangler delete
. Of note, it'll delete a given service, including all it's bindings. It uses the same api as the dashboard.
[email protected]
Patch Changes
-
#2023
d6660ce3
Thanks @caass! - Display a more helpful error when trying to publish to a route in use by another worker.Previously, when trying to publish a worker to a route that was in use by another worker,
there would be a really unhelpful message about a failed API call. Now, there's a much
nicer message that tells you what worker is running on that route, and gives you a link
to the workers overview page so you can unassign it if you want.⛅️ wrangler 2.1.11 -------------------- Total Upload: 0.20 KiB / gzip: 0.17 KiB ✘ [ERROR] Can't publish a worker to routes that are assigned to another worker. "test-custom-routes-redeploy" is already assigned to route test-custom-worker.swag.lgbt Unassign other workers from the routes you want to publish to, and then try again. Visit https://dash.cloudflare.com/<account_id>/workers/overview to unassign a worker from a route.
Closes #1849
-
#2013
c63ca0a5
Thanks @rozenmd! - fix: make d1 help print if a command is incompletePrior to this change, d1's commands would return silently if wrangler wasn't supplied enough arguments to run the command.
This change resolves this issue, and ensures help is always printed if the command couldn't run.
-
#2016
932fecc0
Thanks @caass! - Offer to create a workers.dev subdomain if a user needs onePreviously, when a user wanted to publish a worker to https://workers.dev by setting
workers_dev = true
in theirwrangler.toml
,
but their account didn't have a subdomain registered, we would error out.Now, we offer to create one for them. It's not implemented for
wrangler dev
, which also expects you to have registered a
workers.dev subdomain, but we now error correctly and tell them what the problem is. -
#2003
3ed06b40
Thanks @GregBrimble! - chore: Bump [email protected] -
#2024
4ad48e4d
Thanks @rozenmd! - fix: make it possible for values in vars and defines to have colons (:)Prior to this change, passing --define someKey:https://some-value.com would result in an incomplete value being passed to the Worker.
This change correctly handles colons for var and define in
wrangler dev
andwrangler publish
. -
#2032
f33805d2
Thanks @caass! - Catch unsupported terminal errors and provide a nicer error message.Wrangler depends on terminals supporting raw mode. Previously, attempting to run wrangler from a terminal that didn't support raw mode would result in
an Ink error, which was both an exposure of an internal implementation detail to the user and also not actionable:ERROR Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default. Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported
Now, we provide a much nicer error, which provides an easy next step for th user:
ERROR: This terminal doesn't support raw mode. Wrangler uses raw mode to read user input and write output to the terminal, and won't function correctly without it. Try running your previous command in a terminal that supports raw mode, such as Command Prompt or Powershell.
Closes #1992
-
#1946
7716c3b9
Thanks @penalosa! - Support subdomains with wrangler dev for routes defined withzone_name
(instead of just for routes defined withzone_id
)
@cloudflare/[email protected]
Patch Changes
-
#2004
f2d5728f
Thanks @GregBrimble! - feat: Slightly relax the selectors for generatingLink
headers from<link>
elements in Pages Early Hints featurePreviously, we'd only generate
Link
headers if therel="preload"
orrel="preconnect"
matched exactly. Now, this change will generateLink
headers ifpreload
orpreconnect
appears as a whitespace-separated value in therel
attribute. For example,rel="stylesheet preconnect"
is now valid.For more info, check out this GitHub issue on the Cloudflare Developer Docs repo.
-
#2003
3ed06b40
Thanks @GregBrimble! - chore: Bump [email protected]
[email protected]
Patch Changes
-
#1957
b579c2b5
Thanks @caass! - Remove dependency on create-cloudflare.Previously,
wrangler generate
was a thin wrapper aroundcreate-cloudflare
. Now, we've moved over the logic from that package directly intowrangler
. -
#1985
51385e57
Thanks @rozenmd! - fix: hide deprecated flags from --help menu -
#1944
ea54623c
Thanks @CarmenPopoviciu! -wrangler pages publish
should prioritize_worker.js
over/functions
if both exist -
#1950
daf73fbe
Thanks @CarmenPopoviciu! -wrangler pages dev
should prioritize_worker.js
When using a
_worker.js
file, the entire/functions
directory should be ignored – this includes its routing and middleware characteristics. Currentlywrangler pages dev
does the reverse, by prioritizing
/functions
over_worker.js
. These changes fix the current behaviour. -
#1928
c1722170
Thanks @GregBrimble! - fix: Allow unsetting of automatically generatedLink
headers using_headers
and the! Link
operator -
#1928
c1722170
Thanks @GregBrimble! - fix: Only generateLink
headers from simple<link>
elements.Specifically, only those with the
rel
,href
and possiblyas
attributes. Any element with additional attributes will not be used to generate headers. -
#1974
a96f2585
Thanks @GregBrimble! - chore: Bump @cloudflare/[email protected] and use TS directly -
#1965
9709d3a3
Thanks @JacobMGEvans! - chore: remove hidden on --from-dash
The --from-dash can now be used with the dashboard features to support moving Worker developmment to a local machine.resolves #1783
-
#1978
6006ae50
Thanks @JacobMGEvans! - chore: Undici 5.11.0 multipart/form-data support
The 5.11.0 version of Undici now supports multipart/form-data previously needed a ponyfill
we can now handle the multipart/form-data without any custom code.resolves #1977