Skip to content

fix: hand h3 a standard ReadableStream in dev#2206

Open
brenelz wants to merge 1 commit into
mainfrom
fix/dev-stream-web-readable
Open

fix: hand h3 a standard ReadableStream in dev#2206
brenelz wants to merge 1 commit into
mainfrom
fix/dev-stream-web-readable

Conversation

@brenelz

@brenelz brenelz commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #2133

What is the current behavior?

In dev, the handler returns the raw Solid stream object ({ pipe, pipeTo }) from renderToStream. That only renders on Node by accident: h3 falls through to new FastResponse(body), and srvx's Node adapter duck-types .pipe on the body. Under Bun and Deno, srvx's FastResponse is the native Response, which coerces the unknown object via toString() — the whole page body becomes the literal string [object Object].

Reproduced with bun --bun run dev on 2.0.0-beta.2 and verified the mechanism (srvx bun adapter loads, handler takes the return stream branch). On beta.3+ the bug is currently masked by #2183 adding h3 to ssr.noExternal (Vite's module runner then resolves srvx with node conditions even under bun) — this PR makes the behavior correct by contract instead of by accident.

What is the new behavior?

Dev uses the same path as production: pipe through a TransformStream and return a standard web ReadableStream, which every srvx adapter handles. Verified under bun (bun --bun run vite dev) — correct streamed HTML — and under node.

Other information

The removed special case guarded against a dev-server crash when a stream was cancelled mid-flight (from the Devinxi migration, #1942). That no longer reproduces: solid-js ≥1.9's pipeTo catches every write/close, and aborting curl mid-stream with a 5s Suspense boundary under both node and bun leaves the dev server healthy and serving subsequent requests.

Same conclusion as @GregorLohaus's closed #2134, minus the hardcoded content-type header (already set on the event response by createPageEvent) and without keeping a dev/prod divergence. Also related: #2145/#2148/#2163 (same symptom via the deprecated nitro-v2 plugin).

globalThis.USING_SOLID_START_DEV_SERVER now has no remaining readers; left in place to keep this diff minimal.

Full playwright e2e suite in apps/tests (which runs against vite dev and exercises this branch) passes.

🤖 Generated with Claude Code

The dev path returned the raw Solid stream object ({ pipe, pipeTo })
from renderToStream. That only renders on Node by accident: srvx's
NodeResponse duck-types `.pipe` on the body. Under Bun and Deno, srvx's
FastResponse is the native Response, which coerces the object to the
literal string "[object Object]" - a blank page. Always pipe through a
TransformStream like the production path so h3 receives a standard web
ReadableStream on every runtime.

The special case guarded against a dev-server crash when a stream was
cancelled mid-flight; that no longer reproduces (solid-js's pipeTo
catches every write/close since 1.9), verified by aborting requests
mid-stream under both node and bun with a slow Suspense boundary.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit 147fdb6
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6a5986dcb164f20008e4fc5a
😎 Deploy Preview https://deploy-preview-2206--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 147fdb6

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

This PR includes changesets to release 1 package
Name Type
@solidjs/start 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

@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/start@2206

commit: 147fdb6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug?]: Bun create solid results in broken application.

2 participants