I’m trying to test out @defer/incremental delivery feature. The documentation said it requries graphql@17. So, I added "graphql": "^17" to my dependencies. But npm install gives me this error.
npm ERR! Found: graphql@undefined
npm ERR! node_modules/graphql
npm ERR! graphql@"^17" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer graphql@"^16.6.0" from @apollo/server@4.3.2
npm ERR! node_modules/@apollo/server
npm ERR! @apollo/server@"^4.3.2" from the root project
@Dulguun_Otgon - in order to use defer and graphql v17 with Apollo Server you have to “force” install it using the npm --legacy-peer-deps flag like so:
Is it about the server or gateway? I’ve tried what you suggested but I get the unknown directive error.
I think --legacy-peer-deps option still lets other packages use what they specified in their peerDependencies.
Another question. Will Apollo gateway and server support @defer in the future without force installing dependencies?
Apollo Gateway will never support defer, but Router does (with some caveats). Apollo Server on its own (no federation) does support defer, and will eventually support it without any workarounds once graphql v17 is generally available.