github cloudflare/workers-sdk wrangler@0.0.17

Patch Changes

  • #414 f30426f Thanks @petebacondarwin! - fix: support build.upload.dir when using build.upload.main

    Although, build.upload.dir is deprecated, we should still support using it when the entry-point is being defined by the build.upload.main and the format is modules.

    Fixes #413

  • #447 2c5c934 Thanks @threepointone! - fix: Config should be resolved relative to the entrypoint

    During dev and publish, we should resolve wrangler.toml starting from the entrypoint, and then working up from there. Currently, we start from the directory from which we call wrangler, 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() on faye-websockets with .close()
    added: Interface to give faye same types as compliant ws with additional .pipe() implementation; .on("message" => fn)

  • #462 a173c80 Thanks @caass! - Add filtering to wrangler tail, so you can now wrangler tail <name> --status ok, for example. Supported options:

    • --status cancelled --status error --> you can filter on ok, error, and cancelled 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-format

    This 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 for publish.

  • #438 64d62be Thanks @Electroid! - feat: Add support for "json" bindings

    Did 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: rename open-in-brower.ts to open-in-browser.ts

  • #411 a52f0e0 Thanks @ObsidianMinor! - feat: unsafe-bindings

    Adds 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 open

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

    Fixes #92

  • #474 bfedc58 Thanks @JacobMGEvans! - bugfix: create reporting.toml file in "wrangler/config" and move error reporting user decisions to new reporting.toml

  • #445 d5935e7 Thanks @threepointone! - chore: remove experimental_services from configuration

    Now 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: enable strict in tsconfig.json

    In the march towards full strictness, this enables strict in tsconfig.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.

  • #408 14098af Thanks @mrbbot! - Upgrade miniflare to 2.3.0

  • #448 b72a111 Thanks @JacobMGEvans! - feat: add --yes with alias --y flag as automatic answer to all prompts and run wrangler 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 on init <name> or parent directory if no input is provided.

  • #452 1cf6701 Thanks @petebacondarwin! - feat: add support for publishing workers with r2 bucket bindings

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

    Previously we always published to the workers.dev subdomain, ignoring the workers_dev setting in the wrangler.toml configuration.

    Now we respect this configuration setting, and also disable an current workers.dev subdomain worker when we publish and workers_dev is false.

    Fixes #410

  • #457 b249e6f Thanks @threepointone! - fix: don't report intentional errors

    We 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 both publish and dev commands

    This changes moves the code that does the esbuild bundling into a shared file
    and updates the publish and dev to use it, rather than duplicating the
    behaviour.

    See #396
    Resolves #401

  • #458 c0cfd60 Thanks @petebacondarwin! - fix: pass correct query param when uploading a script

    In f9c1423 the query param was incorrectly changed from
    available_on_subdomain to available_on_subdomains.

  • #432 78acd24 Thanks @threepointone! - feat: import .wasm modules in service worker format workers

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

    This lands support for [wasm_modules] as defined by cloudflare/wrangler#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 buckets

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

    This adds an error when we use an entry point that doesn't exist, either for wrangler dev or wrangler publish, and either via cli arg or build.upload.main in wrangler.toml. By using a common abstraction for dev and publish, This also adds support for using build.config.main/build.config.dir for wrangler dev.

Don't miss a new workers-sdk release

NewReleases is sending notifications on new releases.