question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Query root type must be provided

See original GitHub issue

I seem to be getting this error:

https://github.com/prismagraphql/graphql-import/issues/73

I’m running 0.0.10, with a schema generated by graphql-cli from a gatsby project:

# source: http://0.0.0.0:8000/___graphql
# timestamp: Sat Jul 28 2018 17:46:31 GMT+0000 (Greenwich Mean Time)

schema {
  query: RootQueryType
}

"""
A date string, such as 2007-12-03, compliant with the ISO 8601 standard  for
representation of dates and times using the Gregorian calendar.
"""
scalar Date

# ...

Here’s the full error:

(node:15016) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Query root type must be provided.
(node:15016) 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.

No stack trace, unfortunately.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TEJAPScommented, Sep 13, 2018

const WAUsers = require(‘…/models/wibesAppUsers’); //this is mongodb model

const wAUType = new GraphQLObjectType({ name:‘wAP’, e fields:() => ({ human_name:{type:GraphQLString}, pass_code:{type:GraphQLString}, }) });

const Mutation = new GraphQLObjectType({ name:‘Mutation’, fields:{ addWAUser:{ wAUType, args:{ human_name:{type:new GraphQLNonNull(GraphQLString)}, pass_code:{type:new GraphQLNonNull(GraphQLString)}, }, resolve(parent,args){ let user = new WAUsers({ human_name:args.human_name, pass_code:args.pass_code, }); return user.save(); } } } } })

module.exports = new GraphQLSchema({ mutation:Mutation });

i am importing mongodb model and inserting into it using graphql schema

Read more comments on GitHub >

github_iconTop Results From Across the Web

graphqljs - Query root type must be provided - Stack Overflow
I cannot pass null and if I pass an empty GraphQLObjectType it gives me the error: Type Query must define one or more...
Read more >
Get "Query root type must be provided." error when ... - GitHub
Describe the bug Get error when schema's query root type's name isn't "Query". The code will generate without error when the Query root...
Read more >
query root type must be provided graphql - You.com
Solution 1. All servers running with GraphQL must have at least one @Query () to be considered a valid GraphQL server. Without it,...
Read more >
Creating an Express and GraphQL Server from Scratch
"message": "Query root type must be provided." This message shows up because of the empty schema we created earlier. So, how does it...
Read more >
`yarn graphql-codegen` returns `Error: Query root type must ...
yarn graphql-codegen returns Error: Query root type must be provided. when query root is named other than Query , for example query_root as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found