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.

Apollo must wait to respond until request completes

See original GitHub issue

It appears that all the apollo-server- packages suffer from a bug when using graphql-upload. It is essential to wait for an entire HTTP request to be consumed before responding, or you risk causing very hard-to-diagnose bugs, including locking a browser out of subsequent requests to the server.

The middleware that comes with graphql-upload does this, but was being bypassed in graphql-upload-express, which I fixed here. However, I noticed that the upload middleware bundled with Apollo fails to wait, and will experience these bugs even with that fix.

Please see this issue for context and details (specifically this comment) the accompanying demonstration repo put together with heroic effort by @juona.


This middleware in apollo-server-express might be able to borrow from this one in graphql-upload/express.

This middleware in apollo-server-koa might take from this in graphql-upload/koa.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
vanyadymouskycommented, Jan 20, 2021

Hello, noticed there are no updates for almost a year - is this is hard to use compatibility with graphql-upload/koa or graphql-upload/express? Want to up this issue, it’s pretty critical one.

2reactions
n1ru4lcommented, Mar 1, 2020

@OwenCalvin we finally decided to upload to AWS S3 directly. It reduces the server load and we now simply generate pre-signed URLs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling - Apollo GraphQL Docs
If a request uses an invalid HTTP method ( GET with a mutation, or any HTTP method other than GET or POST ),...
Read more >
How to wait for server response before calling Apollo Graph ...
Short Answer: You can checkout useLazyQuery instead of useQuery.
Read more >
Suspense for Data Fetching (Experimental) - React
We wait for all data to come back with Promise.all() inside fetchProfileData , so now we can't render profile details until the posts...
Read more >
Frequently Asked Questions | Kennedy Space Center
Daily admission to Kennedy Space Center Visitor Complex includes: Space Shuttle Atlantis ® featuring the Shuttle Launch Experience ® ; The Apollo/ Saturn...
Read more >
The Do's and Don'ts of Testing Apollo in React - Adam Hannigan
Writing tests is essential for any Apollo application that aims to ... and GraphQL mocking tools we can automatically build responses that ...
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