-
Notifications
You must be signed in to change notification settings - Fork 12
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
client hangs after failed upload #13
Comments
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
Hey, I can work on this issue. Please assign this issue to me |
Do we have any progress? |
I have not seen a PR addressing this yet. |
I investigated that it is not necessary to have an error on the first request. I used Firefox and 487kb file Snippet to respond true from mutation // index.js
// index.html
|
So, now I tried REST API - only |
Hey @mcollina we have a progress, could you check ticket in Here the last investigation:
|
I took a quick skim and this is an issue is most relevant to the
This module is missing the equivalent of this line, i.e. we should wait for the request to be fully consumed before sending a response. Currently I've seen both @SimenB and @PabloSzx involved in that package, so maybe can they help. |
Thank you for reply |
We use
Adding that should be somewhat straightforward, unless I'm missing something. I'd assume an
This is incorrect. Line 36 in 3a91963
I see the readme is wrong, though: #12 |
Sure, I'll try to use this advice, stay in touch. You can assign me |
I think you should place an |
So, I tried this and it would be enough:
I'll create PR with tests later today. Or you want to use |
|
It is a simple function and I would avoid promise most of the time. |
Closed via #14 |
|
The same error persists after switching to graphql-upload-minimal. |
Same error as @sammwafy 😞 . Fix it as mentioned:
Would be great to revert usage of |
Same as @sammwafy, replacing diff --git a/dist/index.js b/dist/index.js
index 702d96f368943c6030dd1f801b66efb47ac7553a..35640696bf121ece6997f149264edf8d47366d31 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -30,7 +30,7 @@ exports.mercuriusUpload = void 0;
const util = __importStar(require("util"));
const stream_1 = __importDefault(require("stream"));
const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
-const graphql_upload_minimal_1 = require("graphql-upload-minimal");
+const graphql_upload_minimal_1 = require("graphql-upload-ts");
const finishedStream = util.promisify(stream_1.default.finished);
const mercuriusGQLUpload = (fastify, options, done) => {
fastify.addContentTypeParser('multipart', (req, _payload, done) => { You also need to replace every usage of |
This is indeed an issue even if latest code was to be released #24 (comment) it still hangs without @ceopaludetto patch. I did however used the base |
I'm using mercurius + mercurius-upload with a basic mutation resolver that reads an input file to store it to a S3 bucket.
If the resolver fails all the subsequent requests to fastify hang indefinitely.
You can find a minimal reproduction code here: https://github.com/bhamon/bug-graphql-upload
To reproduce the issue you should use Chrome + upload a file of about 300 KB (smaller files doesn't fail).
The issue can be reproduced with other clients too, but depending on the client and the uploaded file the results varies a lot. The client must reuse the same HTTP stream in order for the problem to occurs.
The issue as already been reported here for Apollo server and a corrective PR has been issued.
I'm not very familiar with Fastify internals so I can only assume that the problem should be the same.
The text was updated successfully, but these errors were encountered: