Skip to content

@cloudflare/workers-utils@0.34.0

Choose a tag to compare

@workers-devprod workers-devprod released this 20 Aug 17:42
· 1 commit to main since this release
38b4623

Minor Changes

  • #14995 59872c4 Thanks @ThomasRubini! - Add connect trigger for raw sockets

    You can now configure a Worker to receive raw socket connections during wrangler dev, delivered directly to the Worker's connect(socket, env, ctx) handler:

    {
      "connect": [{ "protocol": "tcp", "port": 5432 }]
    }

    Each entry opens a listening socket on 127.0.0.1 (or the given address) that forwards incoming connections straight to the Worker, bypassing the local dev HTTP entry point. This requires the experimental compatibility flag. Only "tcp" is supported at the moment.

    @cloudflare/config also supports declaring this trigger via triggers.connect(...), which lowers to the connect field above:

    import { defineWorker, triggers } from "@cloudflare/config";
    
    export default defineWorker({
      triggers: [
        triggers.connect({ protocol: "tcp", port: 5432, address: "127.0.0.1" }),
      ],
    });
  • #15172 c68f9cb Thanks @WillTaylorDev! - Add container support to worker previews

    Worker previews now support containers through a new previews.containers configuration block. Container configuration doesn't inherit, so declare containers explicitly in the previews block to enable them for previews. This mirrors how previews.durable_objects works today. Wrangler names each preview container application {worker_name}_{preview_slug}_{class_name}, normalising and shortening the result to what the API accepts. Either change appends a short digest of the composed name, so two names that would otherwise land on one stay distinct. An entry cannot set its own name, because application names are unique to an account and a fixed name would collide between two previews of the same Worker. A Durable Object class is backed by at most one container application, so the validator rejects two entries that share a class_name. Wrangler skips container applications bound to Durable Object classes that another Worker implements through script_name, because the implementing Worker owns its own container application. A binding is not required: a Durable Object declared through migrations or exports and reached only over ctx.exports can still back a container. Every entry must set class_name. A previews.containers entry whose class_name matches no Durable Object class at all is rejected before the preview deployment is created, so a typo fails loudly instead of producing a preview with no container.

    Wrangler creates the container applications on wrangler preview. Deleting a preview tears them down server side, so wrangler preview delete doesn't remove them.

    Container build and deploy progress prints to stdout. wrangler preview --json suppresses wrangler's own output so it doesn't interleave with the payload, and warnings and errors still go to stderr. Docker's build output and the progress spinner write to stdout directly and bypass that suppression, so parse --json from a non interactive shell, where the spinner is skipped, and prefer a prebuilt image over a Dockerfile.

Patch Changes

  • #15251 5c10e39 Thanks @dario-piotrowicz! - Fix ESM-only packages missing from deploy metadata

    ESM-only package dependencies (such as @cloudflare/think) were silently omitted from the package dependency metadata reported during wrangler deploy and wrangler versions upload. These packages are now correctly detected and included.

  • #15284 39dcea6 Thanks @emily-shen! - Move deploy output writing into shared deploy helpers