fix: move delete stream.then after dev-server branch to restore thenable#2163
Closed
tsushanth wants to merge 1 commit into
Closed
fix: move delete stream.then after dev-server branch to restore thenable#2163tsushanth wants to merge 1 commit into
tsushanth wants to merge 1 commit into
Conversation
|
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2145
What
In
packages/start/src/server/handler.ts, the linewas executing before the
USING_SOLID_START_DEV_SERVERearly return. This stripped the.thenproperty from the stream before returning it to the dev server, making it non-thenable.h3 v2's
toResponse/prepareResponseBodyno longer recognizes the value as awaitable and falls through tonew FastResponse(streamObject, …), which stringifies the body to[object Object].Why
delete stream.thenexistsThe deletion is there so that the
TransformStreampath (used for Cloudflare Workers) does not try to await the stream object. It only needs to apply immediately before thenew TransformStream()block, not for the dev-server path.Fix
Move
delete (stream as any).thento after theUSING_SOLID_START_DEV_SERVERguard. The stream stays thenable when returned to the dev server; the deletion still takes effect for the Cloudflare Workers path that follows.Reproduction
Scaffold a SolidStart 2.0.0-alpha.2 project with
@solidjs/vite-plugin-nitro-2per its README (nomodeoption oncreateHandler), runvite dev, andcurl http://localhost:5173/returns[object Object]. After this patch the rendered HTML is returned instead.