-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streaming API Responses Not Working on Vercel #38736
Comments
What is your build command: |
@balazsorban44 does #38862 address this? |
@Onyelaudochukwuka do you mind deleting all your comments? i think you are referring to a separate issue entirely. this is only regarding |
@crazy-slot just |
The problem on this example is that you're a enqueuing strings into your We have already fixed the issue in both Next.js to be consistent making it fail when enqueuing strings and in Vercel to make sure logs with the error are correctly delivered. If you run the example in the latest Next.js canary you will see an error stating: "TypeError: This ReadableStream did not return bytes.". When you deploy to Vercel you will see the same error To fix the code you must first encode the text using |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome 103.0.5060.114
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
I am using the
experimental-edge
runtime for an api route./api/stream
. I am creating a customReadableStream
within this API handler, and returning theReadableStream
to theResponse
body. This works great locally. However, once I deploy to Vercel, the response resolves with no body. The documentation mentions supporting streaming, so not quite sure what I'm doing wrong.Not sure if this bug resides on the Next.js side or Vercel.
Below is the simplest repro I can make.
Expected Behavior
I expect the stream to be returned in chunks, similar to local dev.
{"foo": "bar"}\n
should be returned 10 times.Link to reproduction
https://github.com/jamespantalones/next-js-stream-bug
To Reproduce
npm install
npm run dev
http://localhost:3000/api/stream
and you should see the following:https://next-js-stream-bug.vercel.app/api/hello
The text was updated successfully, but these errors were encountered: