Skip to content
Compare
Choose a tag to compare
@github-actions github-actions released this 05 Jul 11:29
· 3299 commits to main since this release
d529533

Patch Changes

  • #992 ee6b413 Thanks @petebacondarwin! - fix: add warning to fetch() calls that will change the requested port

    In 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 to https://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 the preview command

    Before, we would warn folks that preview was deprecated in favour of dev, but then ran dev on their behalf.
    To avoid maintaining effectively two versions of the dev command, we're now just telling folks to run dev.

  • #1213 1bab3f6 Thanks @threepointone! - fix: pass routes to dev session

    We 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 namespaces

    This 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 bundling

    As a configuration parallel to --no-bundle (introduced in #1300 as --no-build, renamed in #1399 to --no-bundle), this introduces a configuration field no_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 error

    If 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 errors

    The reporter is now called before the publish API call, printing every time.

    resolves #1328

  • #1393 b36ef43 Thanks @threepointone! - chore: enable node's experimental fetch flag

    We'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 directory

    Before 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 CLI

    Closes #1350

  • #1342 6426625 Thanks @rozenmd! - polish: split dev function out of index.tsx

  • #1401 6732d95 Thanks @threepointone! - fix: log pubsub beta usage warnings consistently

    This fix makes sure the pubsub beta warnings are logged consistently, once per help menu, through the hierarchy of its command tree.

    Fixes #1370

  • #1344 7ba19fe Thanks @rozenmd! - polish: move init into its own file

  • #1386 4112001 Thanks @rozenmd! - feat: implement fetch for wrangler's unstable_dev API, and write our first integration test.

    Prior to this PR, users of unstable_dev had to provide their own fetcher, and guess the address and port that the wrangler dev server was using.

    With this implementation, it's now possible to test wrangler, using just wrangler (and a test framework):

    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!"`);
      }
    
      await 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 used

    We 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 using dev --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 tabs

    Fixes #1298

  • #1395 88f2702 Thanks @threepointone! - feat: cache account id selection

    This 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 a node_modules folder, and it looks for the closest node_modules folder (and not directly in cwd). I also added tests for when a node_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 dev

    Previously, 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: normalise account_id = '' to account_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 with undefined while logging a warning.

    This fix also tweaks the messaging for a blank route value to suggest some user action.

  • #1360 cd66b67 Thanks @SirCremefresh! - Updated eslint to version 0.14.47

  • #1363 b2c2c2b Thanks @petebacondarwin! - fix: display email from process env in whoami and display better error when lacking permissions

  • #1343 59a83f8 Thanks @rozenmd! - polish: split generate into its own file

  • #1300 dcffc93 Thanks @threepointone! - feat: publish --no-build

    This adds a --no-build flag to wrangler 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 mb

    The 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: implement config.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 authorise

    This adds support for using the CLOUDFLARE_API_KEY + CLOUDFLARE_EMAIL env vars for authorising a user. This also adds support for CF_API_KEY + CF_EMAIL from wrangler 1, with a deprecation warning.

  • #1352 4e03036 Thanks @JacobMGEvans! - bugfix: Allow route setting to be ""
    Previously Wrangler1 behavior had allowed for route = "". To keep parity it will be possible to set route = "" 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

  • #1349 ef9dac8 Thanks @rozenmd! - polish: move preview into its own file