Skip to content

Fail early when createTestHarness() cannot start its proxy under Bun - #15845

Draft
dario-piotrowicz wants to merge 1 commit into
mainfrom
dario/bun-testharness-listen-fix
Draft

dario-piotrowicz wants to merge 1 commit into
mainfrom
dario/bun-testharness-listen-fix

Conversation

@dario-piotrowicz

Copy link
Copy Markdown
Member

Fixes #15717

When Bun does not deliver the proxy control request required by Miniflare, createTestHarness() now throws an actionable startup error. This prevents the process from remaining idle while every request to the test harness hangs indefinitely.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: better error handling

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot

changeset-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0d71c0e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ask-bonk

ask-bonk Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Sep 24, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15845

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15845

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15845

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15845

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@15845

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15845

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15845

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15845

miniflare

npm i https://pkg.pr.new/miniflare@15845

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15845

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15845

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@15845

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15845

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15845

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15845

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15845

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15845

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15845

wrangler

npm i https://pkg.pr.new/wrangler@15845

commit: 0d71c0e

@oddharsh

Copy link
Copy Markdown
Contributor

I put the change from my issue comment up as #15846, targeting this branch so it reads as a diff on top of your commit. It keeps your detection and the timeout helper, and moves where they fire:

The PR has a test that boots a real ProxyWorker under Node and sends the control request the way Bun does. Against this branch's ProxyWorker it times out, which reproduces the hang without Bun. The red macOS check there is the miniflare R2 ECONNRESET flake (s3.spec.ts), which passes 71/71 locally, and the PR touches nothing in miniflare.

Merge it in or take the idea, whichever suits you.

oddharsh added a commit to oddharsh/workers-sdk that referenced this pull request Oct 7, 2026
… doors

The guard in cloudflare#15845 ran inside listen(), so under Bun it also refused
server.getWorker().fetch(), which never goes through the ProxyWorker and
worked before. Move the check to server.fetch(), and have the ProxyWorker
answer with a 503 once a control request arrives without its payload, so
requests to the listen() URL fail loudly instead of queueing forever.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

[wrangler] createTestHarness() under Bun: listen() succeeds, then server.fetch() and every request to the returned URL hang forever with no error

3 participants