Error: Query root type must be provided.
timsayshey opened this issue · comments
Tim Badolato commented
I am getting this error when the Apollo Server tries to start up.
I copy and pasted the mixin setup from the example and also copy and pasted the welcome
action. It's all pretty much boilerplate. I'm just using a GET
request to hit the /graphql
endpoint.
Please advise. Thanks!
Error: Query root type must be provided.
at assertValidSchema (/app/node_modules/graphql/type/validate.js:71:11)
at assertValidExecutionArguments (/app/node_modules/graphql/execution/execute.js:163:35)
at executeImpl (/app/node_modules/graphql/execution/execute.js:84:3)
at Object.execute (/app/node_modules/graphql/execution/execute.js:62:63)
at Object.generateSchemaHash (/app/node_modules/apollo-server-core/dist/utils/schemaHash.js:14:32)
at ApolloServer.generateSchemaDerivedData (/app/node_modules/apollo-server-core/dist/ApolloServer.js:281:41)
at new ApolloServerBase (/app/node_modules/apollo-server-core/dist/ApolloServer.js:203:38)
at new ApolloServer (/app/lib/moleculer-apollo-server/src/ApolloServer.js:21:1)
at Service.prepareGraphQLSchema (/app/lib/moleculer-apollo-server/src/service.js:407:26)
at Service./ (/app/lib/moleculer-apollo-server/src/service.js:516:13)
at Promise (/app/node_modules/moleculer-web/src/index.js:510:20)
at Promise._execute (/app/node_modules/moleculer/node_modules/bluebird/js/release/debuggability.js:313:9)
at Promise._resolveFromExecutor (/app/node_modules/moleculer/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/app/node_modules/moleculer/node_modules/bluebird/js/release/promise.js:79:10)
at Service.aliasHandler (/app/node_modules/moleculer-web/src/index.js:509:11)
at Promise (/app/node_modules/moleculer-web/src/index.js:383:33)
at <anonymous>
Shawn McKnight commented
GraphQL has a requirement that there must be a Query type provided (I do not know why). The welcome example is a mutation so having it alone does not satisfy the requirement. You will need to have at least one action that is a query to satisfy the need.
Hope that helps!
Tim Badolato commented
Awesome! Thanks @shawnmcknight !!!