Skip to content

Releases: cloudflare/workers-sdk

[email protected]

14 Nov 17:38
ac4deef
Compare
Choose a tag to compare

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]

11 Nov 06:06
2c87b0f
Compare
Choose a tag to compare

Patch Changes

[email protected]

11 Nov 01:05
817f5cc
Compare
Choose a tag to compare

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 scripts

    Prints a warning for scripts > 1MB compressed, encouraging smaller
    script sizes. This warning can be silenced by setting the
    NO_SCRIPT_SIZE_WARNING env variable

    If 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 for wrangler dev on Workers behind Cloudflare Access, utilising cloudflared. If you don't have cloudflared installed, Wrangler will prompt you to install it. If you do, then the first time you start developing using wrangler 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 the wrangler init command.
    Additionally added a checks to the std.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 if node_compat is disabled.

  • #2124 02ca556c Thanks @JacobMGEvans! - Computing the name from binding response
    Now the vars 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 the vars key/value pair.

    resolves #2048

@cloudflare/[email protected]

11 Nov 01:05
817f5cc
Compare
Choose a tag to compare

Patch Changes

[email protected]

02 Nov 17:21
9f509bc
Compare
Choose a tag to compare

Patch Changes

  • #2103 f1fd62a1 Thanks @GregBrimble! - fix: Don't upload functions/ directory as part of wrangler 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 the functions/ 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 a public/blog/how-to-use-pages/_headers file (where public is your build output directory), we will now upload the _headers file as a static asset.

  • #2111 ab52f771 Thanks @GregBrimble! - feat: Add a passThroughOnException() handler in Pages Functions

    This 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 call passThroughOnException() 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]

01 Nov 17:44
0d2d6bf
Compare
Choose a tag to compare

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 modules based on the module type (Text, Data or CompiledWasm).
    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;
    }

    resolves #2034
    resolves #2033

  • #2065 14c44588 Thanks @CarmenPopoviciu! - fix(pages): wrangler pages dev matches routing rules in _routes.json too loosely

    Currently, the logic by which we transform routing rules in _routes.json to
    regular expressions, so we can perform pathname matching & routing when we
    run wrangler 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 deleted

    This 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 with wrangler 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 using wrangler dev --local. Logs from Miniflare will now be
    coloured too, if the terminal supports this.

[email protected]

21 Oct 06:58
ecc8b17
Compare
Choose a tag to compare

Patch Changes

  • #2049 903b55d1 Thanks @rozenmd! - fix: add missing local argument to unstable_dev's DevOptions

  • #2026 7d987ee2 Thanks @GregBrimble! - fix: Default to today's compatibility date in wrangler 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 basic wrangler 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]

17 Oct 19:54
6c8d013
Compare
Choose a tag to compare

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 incomplete

    Prior 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 one

    Previously, when a user wanted to publish a worker to https://workers.dev by setting workers_dev = true in their wrangler.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 and wrangler 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 with zone_name (instead of just for routes defined with zone_id)

@cloudflare/[email protected]

17 Oct 19:54
6c8d013
Compare
Choose a tag to compare

Patch Changes

[email protected]

10 Oct 14:53
4d3c2d0
Compare
Choose a tag to compare

Patch Changes

  • #1957 b579c2b5 Thanks @caass! - Remove dependency on create-cloudflare.

    Previously, wrangler generate was a thin wrapper around create-cloudflare. Now, we've moved over the logic from that package directly into wrangler.

  • #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. Currently wrangler 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 generated Link headers using _headers and the ! Link operator

  • #1928 c1722170 Thanks @GregBrimble! - fix: Only generate Link headers from simple <link> elements.

    Specifically, only those with the rel, href and possibly as 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