fastapi streaming response is not decoded in chunks with compression enabled
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/HP2706/nextjs_streaming_bug
To Reproduce
to reproduce run npm run dev from root of the project
preferably use an virtual environment with Python 3.9.18
next click on the "stream" button
about 10 seconds later the number 1 .. 10 will appear on the screen
next to next.config.mjs and uncomment compression : false
now reload and click again.
this time the numbers will actually be stream as expected from the fastapi endpoint
Current vs. Expected behavior
i would expect the client to receive the streamingResponse from fastapi in chunks and not all at once even even without explicitly disabling compression
Provide environment information
Node : v21.5.0
os : darwin 23.2.0
Python : 3.9.18
fastapi : 0.100.1
uvicorn :0.23.2
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Vercel (Deployed)
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction repository and its npm run dev flow; compare streaming with compression enabled against next.config.mjs with compression: false. Check the FastAPI endpoint and the affected Next.js stages listed in the issue. Done means the client receives the response in chunks while compression remains enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, javascript, nextjs, node.js, python
- Domain
- api, backend, full-stack, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100