When I using the sample/12-graphql-apollo project, and I remove the graphql file, then run this project.
It throws some error:
(node:5278) UnhandledPromiseRejectionWarning: Error: Specified query type "Query" not found in document.
at /home/dzzzzzy/workspace/nestjs/nest/sample/12-graphql-apollo/node_modules/graphql/utilities/buildASTSchema.js:133:17
at Array.forEach (<anonymous>)
at Object.buildASTSchema (/home/dzzzzzy/workspace/nestjs/nest/sample/12-graphql-apollo/node_modules/graphql/utilities/buildASTSchema.js:126:30)
at buildSchemaFromTypeDefinitions (/home/dzzzzzy/workspace/nestjs/nest/sample/12-graphql-apollo/node_modules/graphql-tools/src/schemaGenerator.ts:225:32)
at _generateSchema (/home/dzzzzzy/workspace/nestjs/nest/sample/12-graphql-apollo/node_modules/graphql-tools/src/schemaGenerator.ts:92:18)
at Object.makeExecutableSchema (/home/dzzzzzy/workspace/nestjs/nest/sample/12-graphql-apollo/node_modules/graphql-tools/src/schemaGenerator.ts:120:20)
at GraphQLFactory.createSchema (/home/dzzzzzy/workspace/nestjs/nest/sample/12-graphql-apollo/node_modules/@nestjs/graphql/dist/graphql.factory.js:23:32)
at ApplicationModule.createSchema (/home/dzzzzzy/workspace/nestjs/nest/sample/12-graphql-apollo/src/app.module.ts:41:32)
at ApplicationModule.configure (/home/dzzzzzy/workspace/nestjs/nest/sample/12-graphql-apollo/src/app.module.ts:24:25)
at MiddlewareModule.loadConfiguration (/home/dzzzzzy/workspace/nestjs/nest/sample/12-graphql-apollo/node_modules/@nestjs/core/middleware/middleware-module.js:35:18)
(node:5278) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:5278) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
When console.log(typeDefs) with none graphql file at other projects, it always throw this error and console shows:
schema {
query: Query
}
Could you provide a repository that reproduces your issue?
Same here:
(node:1646) UnhandledPromiseRejectionWarning: Error: Specified query type "Query" not found in document.
at getOperationTypes (/Users/antontemchenko/Projects/nest/node_modules/graphql/utilities/buildASTSchema.js:157:17)
at Object.buildASTSchema (/Users/antontemchenko/Projects/nest/node_modules/graphql/utilities/buildASTSchema.js:94:36)
at Object.buildSchemaFromTypeDefinitions (/Users/antontemchenko/Projects/nest/node_modules/graphql-tools/src/generate/buildSchemaFromTypeDefinitions.ts:43:32)
at Object.makeExecutableSchema (/Users/antontemchenko/Projects/nest/node_modules/graphql-tools/src/makeExecutableSchema.ts:52:18)
at GraphQLFactory.<anonymous> (/Users/antontemchenko/Projects/nest/node_modules/@nestjs/graphql/dist/graphql.factory.js:43:62)
at Generator.next (<anonymous>)
at /Users/antontemchenko/Projects/nest/node_modules/@nestjs/graphql/dist/graphql.factory.js:16:71
at new Promise (<anonymous>)
at __awaiter (/Users/antontemchenko/Projects/nest/node_modules/@nestjs/graphql/dist/graphql.factory.js:12:12)
at GraphQLFactory.mergeOptions (/Users/antontemchenko/Projects/nest/node_modules/@nestjs/graphql/dist/graphql.factory.js:36:16)
(node:1646) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:1646) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Steps to reproduce:
in new nestjs project follow graphql quickstart:
npm i --save @nestjs/graphql apollo-server-express graphql-tools graphqlI get the exact same error as well trying to follow the official tutorial at https://docs.nestjs.com/graphql/quick-start
Ensure to update @nestjs/graphql to latest version.
I'm using version 5.2.2 of @nestjs/graphql and am still getting the same error as @antontemchenko by following the same four steps in the GraphQL quick start.
Just pushed 5.2.3 temporary fix. The issue comes from the underlying lib: https://github.com/okgrow/merge-graphql-schemas/issues/155
Thanks! Appreciate the super fast fix. You've got a great framework here, really enjoying learning it!
Faced some issues with GraphQL playground. For better UX I encourage to update into 5.3.0
Thanks! Was beating my head against the wall last night wondering why the playgound was having server connection errors.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Just pushed 5.2.3 temporary fix. The issue comes from the underlying lib: https://github.com/okgrow/merge-graphql-schemas/issues/155