Answer 413 instead of cutting the connection when a request body is too large
I maintainer di solito rispondono entro 1 giorno
@PrathamAsrani ci sta già lavorando.
Dal 25/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
The task
When a request body is larger than its limit (for example an import bigger than MAX_IMPORT_MB), the server should answer 413 Payload too large with its usual JSON error. Today it cuts the connection instead: curl fails with error 56, and the app can only show a generic network error, so the user never learns that the file was simply too big.
The cause is in readBody: after rejecting with a 413, it calls req.destroy(), which closes the socket before the error response can be sent. Stop buffering the body instead, let the 413 response go out, and close the connection only after it (for example with a Connection: close header).
Where to look
server/server.js, functionreadBody(around line 297)tests/api.test.mjs, testimport: replaces the map, validates ids, and enforces MAX_IMPORT_MB: it currently accepts either a 413 or a closed connection, which hides the bug
Reproduce: start the server with MAX_IMPORT_MB=1 and post a 1.3 MB JSON body to /api/import.
Done when
- An oversized body gets a
413response with{"error": "Payload too large"} - The test asserts exactly
413(drop theconnection closedalternative) - The server keeps working for the next request
-
npm testpasses
Mentor
@0b3l1X-SolidGeeks
- Lingua principale
- JavaScript
- Stelle
- 0
- Fork
- 1
- Merge medio
- 14m
- PR unite (30g)
- 31
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SolidGeeks/strata
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SolidGeeks/strata#21 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
SolidGeeks/strata#22 ·
I maintainer di solito rispondono entro 1 giorno
-
help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
SolidGeeks/strata#20 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di SolidGeeks/strata
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apex-dev-tools/apex-log-parser#199 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue hacktoberfest help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
ReadBufferStream.addBuffer adds the full ArrayBuffer of a typed array view, and ignores its byteOffsetForse già presa @wayfarer3130 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Expo 57 example: pnpm install fails with ERR_PNPM_TRUST_DOWNGRADEForse già presa @github-actions l’ha presa oggi. Apertabug react-native team/client-libraries
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
PostHog/posthog-js#5442 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno