Skip to content
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

Specified query type "Query" not found in document with none graphql file. #39

Closed
dzzzzzy opened this issue Jul 27, 2018 · 11 comments
Closed

Comments

@dzzzzzy
Copy link

dzzzzzy commented Jul 27, 2018

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
}
@kamilmysliwiec
Copy link
Member

Could you provide a repository that reproduces your issue?

@antontemchenko
Copy link

antontemchenko commented Sep 11, 2018

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.

@antontemchenko
Copy link

antontemchenko commented Sep 11, 2018

Steps to reproduce:
in new nestjs project follow graphql quickstart:

  1. npm i --save @nestjs/graphql apollo-server-express graphql-tools graphql
  2. Import GraphQLModule to ApplicationModule
  3. Start an application (prod / dev)
  4. Observe an error.

@davidlav
Copy link

I get the exact same error as well trying to follow the official tutorial at https://docs.nestjs.com/graphql/quick-start

@kamilmysliwiec
Copy link
Member

Ensure to update @nestjs/graphql to latest version.

@davidlav
Copy link

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.

@kamilmysliwiec
Copy link
Member

Just pushed 5.2.3 temporary fix. The issue comes from the underlying lib: Urigo/merge-graphql-schemas#155

@davidlav
Copy link

davidlav commented Sep 12, 2018

Thanks! Appreciate the super fast fix. You've got a great framework here, really enjoying learning it!

@kamilmysliwiec
Copy link
Member

Faced some issues with GraphQL playground. For better UX I encourage to update into 5.3.0

@davidlav
Copy link

Thanks! Was beating my head against the wall last night wondering why the playgound was having server connection errors.

@lock
Copy link

lock bot commented Apr 25, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants