Closed heyask closed 3 months ago
This change is not correct; what it does is causes the entire multipart request stream to finish uploading before resolving the operations. By design the operations is supposed to resolve before the files start streaming in, so that way GraphQL resolvers can decide how to handle the file upload streams as they come in.
You can see a graphic showing how this approach makes the overall timings for a GraphQL response better here:
https://github.com/jaydenseric/graphql-multipart-request-spec/blob/master/readme.md
As per https://github.com/jaydenseric/graphql-upload/issues/384#issuecomment-2041337054 , make sure that you are consuming readable streams for every upload in resolvers.
Fix #384
We're encountering a situation where only the first
GraphQLUpload
argument in a GraphQL request gets processed. Subsequent arguments result in empty uploads. This behavior seems to be linked to the busboy parser'sfield
event being triggered multiple times, corresponding to the number of GraphQLUpload arguments present.To address this, we've moved the promise resolution to the
finish
event. This ensures that the promise only resolves after all files have been processed, successfully capturing all uploads in the request.