Allow server function to return ReadableStream #49358
Replies: 3 comments
-
To put some context around this (as I believe I am facing the same issue) we're looking to be able to return ReadableStream objects from Server Actions. I believe this is an impossibility with the current architecture due to how the return values are serialized from Server Actions. I get the following at runtime when attempting to do exactly that: It would be good to understand if this is just a temporary limitation that could be solved with some tweaks / additions, or if it's fundamentally impossible. Either way, updating the docs to make this limitation more visible would be ideal: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions |
Beta Was this translation helpful? Give feedback.
-
I am facing this right now, any updates? I am trying to pass stream.toReadableStream(); using OpenAI from server action to the client. |
Beta Was this translation helpful? Give feedback.
-
I believe this is possible since Vercel's AI SDK has stream from server function link |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
I want to stream data from server to client, and would like to use a ReadableStream for this.
Background
Don't know background.
Proposal
Allow server function to return ReadableStream.
Beta Was this translation helpful? Give feedback.
All reactions