feat(sveltekit): add Lambda response streaming support#6674
Open
ekaya97 wants to merge 1 commit intoanomalyco:devfrom
Open
feat(sveltekit): add Lambda response streaming support#6674ekaya97 wants to merge 1 commit intoanomalyco:devfrom
ekaya97 wants to merge 1 commit intoanomalyco:devfrom
Conversation
SvelteKit on SST now uses Lambda response streaming instead of buffered responses. This ships a custom streaming handler (like React and Remix already have) that replaces the buffered handler from svelte-kit-sst at deploy time. Includes a /streaming demo route in the example app. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
sst.aws.SvelteKit, matching the existing support in React and Remixplatform/functions/sveltekit-server/server.mjs) that SST copies into the build output at deploy time, replacing the buffered handler fromsvelte-kit-sststreaming: truein the SvelteKit component's build plan so the Lambda function URL is configured for streaming modeHow it works
svelte-kit-sstadapter (no adapter changes needed)buildPlan(), SST copies the streaming handler into the server output directory alongside the adapter'sServer,manifest, and prerendered file listawslambda.streamifyResponse()to stream responses — the HTML shell and instant data arrive immediately, while deferred promises resolve progressivelyDemo
The example app includes a
/streamingroute that demonstrates progressive streaming with deferred data:sveltekitstreaming.mp4
Test plan
examples/aws-svelte-kit— verifiedGET /,GET /streaming,POST,HEAD, 404, static assets, query strings all work correctlyx-amzn-remapped-content-lengthheader present (Lambda streaming signature)/streamingroute streams instant data immediately, then resolves 2s and 4s deferred promises progressively