# Response text is streaming only as a single chunk

**URL:** <https://answers.netlify.com/t/response-text-is-streaming-only-as-a-single-chunk/144431>\
**Category:** Support\
**Tags:** lambda-functions, edge\_functions, deployment\
**Created:** [April 10, 2025, 9:01pm UTC](https://answers.netlify.com/t/response-text-is-streaming-only-as-a-single-chunk/144431 "2025-04-10T21:01:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![devsquad](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@devsquad](https://answers.netlify.com/u/devsquad)\
**Post date:** [April 10, 2025, 9:01pm UTC](https://answers.netlify.com/t/response-text-is-streaming-only-as-a-single-chunk/144431/1 "2025-04-10T21:01:11Z")

</div>

We’re trying to build a simple OpenAI chat widget, but are having troubles with text response streaming.

`new Response(new ReadableStream(...))`

I’ve created a simple reproduction app with SvelteKit

[https://text-streaming-test.vercel.app](https://text-streaming-test.vercel.app) - works great on Vercel, the text is streamed in chunks and progressively rendered

[https://text-stream.netlify.app](https://text-stream.netlify.app) - doesn’t work as expected on Netlify, text is returned as a single chunk, so it seems like it waits until the ReadableStream is complete before sending the response

Both are on free tier, but I don’t think the timeout is the issue as the chunks start streaming prior to the limit.  
The code is identical apart from the build adapters.

> **[GitHub - v1adko/text-streaming-test: Testing text streaming on Netlify vs Vercel in...](https://github.com/v1adko/text-streaming-test)**
>
> Testing text streaming on Netlify vs Vercel in SvelteKit

Is this a limitation of the platform?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [April 12, 2025, 6:07pm UTC](https://answers.netlify.com/t/response-text-is-streaming-only-as-a-single-chunk/144431/2 "2025-04-12T18:07:52Z")

</div>

SvelteKit still uses Netlify Functions v1: [kit/packages/adapter-netlify/src/serverless.js at main · sveltejs/kit](https://github.com/sveltejs/kit/blob/main/packages/adapter-netlify/src/serverless.js#L60). It requires extra steps for streaming: [Lambda compatibility for Functions | Netlify Docs](https://docs.netlify.com/functions/lambda-compatibility/?fn-language=ts#response-streaming), but SvelteKit does nothing to implement that conversion in its adapter. Functions v2 can natively stream data: [Get started with functions | Netlify Docs](https://docs.netlify.com/functions/get-started/#synchronous-function), 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`](https://developer.mozilla.org/en-US/docs/Web/API/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](https://answers.netlify.com/t/107200/21). 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).
