Response text is streaming only as a single chunk

SvelteKit still uses Netlify Functions v1: kit/packages/adapter-netlify/src/serverless.js at main · sveltejs/kit. It requires extra steps for streaming: Lambda compatibility for Functions | Netlify Docs, but SvelteKit does nothing to implement that conversion in its adapter. Functions v2 can natively stream data: Get started with functions | Netlify Docs, quoting:

Synchronous functions can stream data to clients as it becomes available, rather than returning a buffered payload at the end of the computation. This lets developers and frameworks create faster experiences by using streaming and partial hydration to get content and interactions in front of people as quickly as possible.

To stream a function’s response, return a ReadableStream as the body property of the Response object.

But SvelteKit is yet to upgrade itself to use that. I had attempted to write an adapter to use Functions v2: Netlify Blobs: accessing from function (inside SvelteKit app) requiring explicit token, siteId, deployId - #21 by hrishikesh. You can try using that if you’d like (though I haven’t extensively tested it - it worked in a basic hello-world kinda app).