Skip to content

fix: move delete stream.then after dev-server branch to restore thenable#2163

Closed
tsushanth wants to merge 1 commit into
solidjs:mainfrom
tsushanth:fix/delete-stream-then-ordering
Closed

fix: move delete stream.then after dev-server branch to restore thenable#2163
tsushanth wants to merge 1 commit into
solidjs:mainfrom
tsushanth:fix/delete-stream-then-ordering

Conversation

@tsushanth

Copy link
Copy Markdown

Fixes #2145

What

In packages/start/src/server/handler.ts, the line

delete (stream as any).then;

was executing before the USING_SOLID_START_DEV_SERVER early return. This stripped the .then property from the stream before returning it to the dev server, making it non-thenable.

h3 v2's toResponse / prepareResponseBody no longer recognizes the value as awaitable and falls through to new FastResponse(streamObject, …), which stringifies the body to [object Object].

Why delete stream.then exists

The deletion is there so that the TransformStream path (used for Cloudflare Workers) does not try to await the stream object. It only needs to apply immediately before the new TransformStream() block, not for the dev-server path.

Fix

Move delete (stream as any).then to after the USING_SOLID_START_DEV_SERVER guard. The stream stays thenable when returned to the dev server; the deletion still takes effect for the Cloudflare Workers path that follows.

if (mode === "async") return await stream;

if (globalThis.USING_SOLID_START_DEV_SERVER) return stream;

// remove thenable so h3/Cloudflare Workers do not await the stream object;
// must happen after the dev-server branch so the stream remains awaitable
// when returned to solid-start-dev-server above
delete (stream as any).then;

const { writable, readable } = new TransformStream();
stream.pipeTo(writable);
return readable;

Reproduction

Scaffold a SolidStart 2.0.0-alpha.2 project with @solidjs/vite-plugin-nitro-2 per its README (no mode option on createHandler), run vite dev, and curl http://localhost:5173/ returns [object Object]. After this patch the rendered HTML is returned instead.

@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a289242

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@netlify

netlify Bot commented Jun 24, 2026

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit a289242
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6a3b3099c3b38100087c2a85
😎 Deploy Preview https://deploy-preview-2163--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.

@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/start@2163
npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/vite-plugin-nitro-2@2163

commit: a289242

@brenelz brenelz closed this Jun 25, 2026
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?]: Dev server returns "[object Object]" with nitroV2Plugin on 2.0.0-alpha.2

2 participants