-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
error ApolloError: Expected (a schema) to be a GraphQL schema #6621
Comments
I should mention that there is no other errors present and that the client hydrates correctly using the exact same schema, so it's clearly valid. |
More information. |
@apollo/client/link/schema does not work as described in the documentation where `@apollo/link-schema` does with Apollo Client v3. Even if `@apollo/client/link/schema` is the way forward, it's currently broken and anyone reading this rn will hit errors. apollographql#6621
@apollo/client/link/schema does not work as described in the documentation (#6621), whereas `@apollo/link-schema` does still work with Apollo Client v3.
This prevents the @apollo/client/link/schema CommonJS bundle (which is used by Node.js) from accidentally pulling in the entire dependency tree of graphql/execution/execute. This duplication not only increased the @apollo/client/link/schema CJS bundle size from 1.31kB to a whopping 22.6kB, but also caused instanceof to stop working reliably for types like GraphQLSchema, because there might be more than one definition of that constructor in play, and instanceof is sensitive to the exact constructor function you pass as the right-hand argument. Should fix #6621, allowing us to revert #6622. Thanks to @stolinsky for surfacing this issue.
Fix incoming: #6624 |
This prevents the @apollo/client/link/schema CommonJS bundle (which is used by Node.js) from accidentally pulling in the entire dependency tree of graphql/execution/execute. This duplication not only increased the @apollo/client/link/schema CJS bundle size from 1.31kB to a whopping 22.6kB, but also caused instanceof to stop working reliably for types like GraphQLSchema, because there might be more than one definition of that constructor in play, and instanceof is sensitive to the exact constructor function you pass as the right-hand argument. Should fix #6621, allowing us to revert #6622. Thanks to @stolinski for surfacing this issue.
This should now be fixed in |
I'm facing the same issue here, I can use the schema in the client perfectly fine but when I try to use it with SSR fails with this error:
My code:
schema:
dependencies:
|
Hi @nicosampler, I have exactly the same issue: using SchemaLink the schema gets wrapped into a |
I just found the reason why it was wrapped with |
Intended outcome:
Actual outcome:
How to reproduce the issue:
Versions
After upgrading to Apollo Client 3, my SSR no longer connects via Apollo-Schema-Link. Getting the error.
Not sure what's changed here, but I'm using the proper imports
Not sure how the schema that I'm passing in is suddenly no longer a valid GraphQL Schema. The error only shows up in useQuery return errors. Not seeing an error anywhere else.
This same setup worked up until moving off of apollo-client rc's and moving to the new
import { SchemaLink } from '@apollo/client/link/schema'
import.I don't have a reproduction because of how complex these things are, but seeing as how the same code worked with the release candidate, it seems like a bug to me.
The text was updated successfully, but these errors were encountered: