You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This throws "Cannot return null for non-nullable field Definition.a."constserver=newApolloServer({schema: mergeSchemas({schemas: [createSchema()],resolvers: {}})});// This throws "This is an error" from the resolverconstserver=newApolloServer({schema: createSchema()});
Expected behaviour
I've expected to see a "This is an error" error in the console in both cases as the typeDefs and schema is the same.
Actual behaviour
Apollo throws "Cannot return null for non-nullable field Definition.a." when using mergeSchemas and "This is an error" without mergeSchemas.
More details
"This is an error" is not in the console output
"This is an error" is not in formatError. Neither as err nor as err.originalError
There seems to be a relation between makeExecutableSchema, mergeTypeDefs and mergeSchemas, because it only happens when using this combination
Throwing the error inside the mutation resolver works and shows the error
I'm using apollo-server in version 2.19.0
Let me know if there's anything I can help with. It took me several hours to reproduce this bug. The code example is reduced and I'm obviously not merging one schema in the code I've actually written ;)
The text was updated successfully, but these errors were encountered:
mergeSchemas is part of the graphql-tools project. This was previously maintained by the Apollo Server team but it is now maintained by its own community at https://www.graphql-tools.com/
While AS2 does re-export the symbols from graphql-tools v4 for "convenience", graphql-tools v4 is not being maintained. It's quite possible that your concern has already been fixed in newer versions of graphql-tools (I believe mergeSchemas is part of @graphql-tools/merge.) If the bug still exists, report it in https://github.com/ardatan/graphql-tools !
Using
mergeSchemas
together withmakeExecutableSchema
leads to different errors, even when just merging one schema.Example
https://codesandbox.io/s/immutable-tdd-wlwrz?file=/index.js
Expected behaviour
I've expected to see a "This is an error" error in the console in both cases as the typeDefs and schema is the same.
Actual behaviour
Apollo throws "Cannot return null for non-nullable field Definition.a." when using
mergeSchemas
and "This is an error" withoutmergeSchemas
.More details
err
nor aserr.originalError
makeExecutableSchema
,mergeTypeDefs
andmergeSchemas
, because it only happens when using this combination2.19.0
Let me know if there's anything I can help with. It took me several hours to reproduce this bug. The code example is reduced and I'm obviously not merging one schema in the code I've actually written ;)
The text was updated successfully, but these errors were encountered: