question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

There seems to be no error handling. I ran into an error where I had set the files limit to 1 and was trying to upload multiple files and busboy wasn’t emitting an event but apollo-upload-server was create a promise that would never resolve and the request would start hanging.

  1. We fist need to handle the special limits events in busboy here, https://github.com/mscdex/busboy#busboy-special-events and reject the promise if any of those are raised.
  2. And the inner promise should reject if the mapFieldname does not match the fieldName,
if (fieldName === mapFieldname) { // }
else { reject(new Error(`Field name mismatches ${fieldName} !== ${mapFieldname}`));
  1. I guess we should resolve the top level promise only on the busboy finish event.

And finally maybe the request.pipe/busboy might have some error events which need to consumed and reject the promise for safety sake.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
jaydensericcommented, Dec 21, 2017

I have been working on error handling all day, and have made a lot of progress but it might take a bit longer to work out the kinks. It’s amazing how little info there is on handling edge cases with Node.js streams and multipart requests, such as handling users aborting the request halfway though. Even basic questions, like how to deliberately interrupt and shutdown a stream with an error are hard to Google.

In the end, File upload scalar promises will reject with meaningful errors for all the various cases, and if an error such as a file size limit or aborted request happens when a file is still being streamed the stream will receive a meaningful error event. If a request is aborted, cutting off a stream, the stream will have a truncated property like what busboy does for files that are too big.

Really complicated 😓

0reactions
SergioSuarezDevcommented, Nov 2, 2021

I just ran into this problem too. I have a maxFileSize of 25mb set and tried to upload a 100mb file. No error was thrown and I ended up with a corrupt 25mb file on my server. I expected this to error out.

I have same problem and I created a issue: https://github.com/jaydenseric/graphql-upload/issues/274

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Error Handling? - Definition from Techopedia
Error handling refers to the response and recovery procedures from error conditions present in a software application. In other words, it is the...
Read more >
What is Exception Handling? - SearchSoftwareQuality
Exception handling is the process of responding to unwanted or unexpected events when a computer program runs. Exception handling deals with these events...
Read more >
Express error handling
Error Handling refers to how Express catches and processes errors that occur both synchronously and asynchronously. Express comes with a default error ...
Read more >
Exception handling
In computing and computer programming, exception handling is the process of responding to the occurrence of exceptions – anomalous or exceptional conditions ...
Read more >
Control flow and error handling - JavaScript - MDN Web Docs
Exception handling statements. You can throw exceptions using the throw statement and handle them using the try...catch statements.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found