keystonejs / keystonejs/keystone
BadRequestError: Request disconnected during file upload stream parsing.
- Dominant language
- TypeScript
- Stars
- 10k
- Forks
- 1.3k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 19
Description
It's hard to replicate this exactly because it may be a network problem.
We see an uncaught error sometimes when uploading files (specifically using the keystone cloudinary field, however it seems it may be related to keystone core instead). It causes our node process to crash in production as it's uncaught.
```
BadRequestError: Request disconnected during file upload stream parsing.
at IncomingMessage. (/home/node/app/src/node_modules/graphql-upload/processRequest.js:338:11)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:400:28)
at abortIncoming (_http_server.js:570:9)
at socketOnClose (_http_server.js:562:3)
at Socket.emit (events.js:412:35)
at TCP. (net.js:686:12)
Emitted 'error' event on ReadStream instance at:
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
expose: true,
statusCode: 499,
status: 499
```
From what I can tell this error is being thrown by the `graphql-upload` library here: https://github.com/jaydenseric/graphql-upload/blob/master/processRequest.mjs#L336-L341 - maybe by simulating that you'll be able to replicate the issue?
It'd be great if this error was caught and handled.
I'd expect an error response to be returned from the graphql upload request in the usual way, without the process exiting. Some sort of retry would be amazing, but I'll take not crashing for now. :)
node version is 14.21.1
@keystone/core is at 4.0.1
Contributor guide
Assessment
This issue has not been assessed yet.