MaxFileSizeUploadError can't be caught and crashes the server
See original GitHub issueHi!
I have a problem with a custom middleware and the use of the processRequest function. Here is my custom middleware:
try {
return processRequest(request, options)
.then(body => {
console.log("body is : ", body);
ctx.request.body = body;
return next();
})
.catch(error => {
console.log("Error catched : ", error);
if (error.status && error.expose) response.status(error.status);
return next(error)
});
} catch (error) {
console.log("Error catched bis : ", error);
}
If I try to upload a file bigger than the allowed limit, I get the following error and my app crash.
events.js:137
throw er; // Unhandled 'error' event
^
MaxFileSizeUploadError: File truncated as it exceeds the size limit.
at FileStream.file.stream.once (/Volumes/lake/projects/evibe/api-lovejs/node_modules/apollo-upload-server/lib/middleware.js:35:13)
at Object.onceWrapper (events.js:255:19)
at FileStream.emit (events.js:160:13)
I can’t capture the error. Any idea?
Thanks 😃
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:16 (8 by maintainers)
Top Results From Across the Web
How to Fix the upload_max_filesize Error in WordPress
Method 1. Editing the .htaccess File ... The quickest fix for the uploaded file exceeds the upload_max_filesize directive in php.ini error is ...
Read more >PHP File Upload greater than upload_max_filesize and error
The error is in $_FILES['userfile']['error'] . You just have to check that this value is UPLOAD_ERR_INI_SIZE to detect if the file is bigger ......
Read more >The Uploaded File Exceeds the upload_max_filesize Directive ...
If the file size of the upload exceeds the maximum upload size configuration on your hosting server, you'll see this error message. The...
Read more >Increase Upload Max File Size on Localhost Server XAMPP or ...
MAMP #XAMPP # Upload Files SizeOne of the biggest issues we experience with local servers or servers in general is the default limits...
Read more >Server crashes with error 500 when uploading 100mb file
I'm trying to upload a 100MB zip file to my server but it just crashes. I got some error logs saying that it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the same problem, in my case file stream throw error and not exist handlers for that error.
Solution in my case: wrap stream in promise
@jaydenseric I use
apollo-server-koa
, how can i fix this? waitapollo-server-koa
use new version ofapollo-upload-server
?