-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MaxFileSizeUploadError can't be caught and crashes the server #45
Comments
As a complement, I tried the apollo-upload-example, setting this options:
And I get the same crash:
|
I don't know why this is not working, I could swear it used to work. I added a (failing) test for when For some reason an emitted Help on this would be appreciated. Worse case, we need to drop the event monkeypatch and publish a major new version that just uses the busboy API for oversized files: A |
If you want to take a crack at it just clone the repo, and in it run |
same
the output is:
|
@roytan883 Apollo Server uses an old version that has bugs :( |
The bug is the exception throw to top level, i use process object can get it:
find:
|
@jaydenseric I use |
Yes, you have to wait for them to update unfortunately. That is the cost of magic packages that abstract a lot of things; you lose control 😓 Apollo aims to support Node.js v6+, but new versions of this package support v8.5+ making them hesitant to upgrade despite all the improvements. We're looking at what has to happen to get Node.js v6.10+ support for this package for future releases, but it is not a sure thing as it is really complicated dealing with API differences in aborted network requests, destroying streams, etc. It would be brilliant for Apollo to update support to v8.5+. I consider that the first modern version, with native async/await, ESM, etc. |
@roytan883 you might be interested in |
@jaydenseric So far, I can only manually force to use outside new version
|
I had the same problem. @jaydenseric |
@Awalgawe there are no known bugs about this in the current version of The operations need to resolve before the entire request has finished parsing so that we can have an API that has file upload streams in resolvers, like the "async" version in this graphic: |
still have this error using graphqlUploadExpress and graphql-upload 11.0.0 |
@mi-mazouz if you are sure everything is setup correctly in your project and that there might be a
It should be pretty easy to work on:
If you can produce a failing test case then we can figure out a patch against that. |
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 export const resolvers = {
// ... other resolvers ...
Mutation: {
uploadImageResolver: async (_, { image }) => {
// throwing error
await new Promise(async (res, rej) => {
const { createReadStream } = await image;
const stream = createReadStream();
stream.on("error", (err) => {
rej(err);
});
// ... some code about using that stream, like save file ...
// await saveFile(stream);
res(); // success
});
},
},
}; |
Hi!
I have a problem with a custom middleware and the use of the processRequest function.
Here is my custom middleware:
If I try to upload a file bigger than the allowed limit, I get the following error and my app crash.
I can't capture the error.
Any idea?
Thanks :)
The text was updated successfully, but these errors were encountered: