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.

A schema MUST have a 'query' operation defined Error. But I have type Query in my schema.

See original GitHub issue

I have added my schema to a .graphql file in my main project directory. I now get this error: image

This is very weird because I do have a type Query {} in my .graphql file with multiple queries in there. When I copied the Query type into an empty .graphql file and I changed all the return types to strings I did not get the error anymore. To Reproduce I don’t really know how you could reproduce this I don’t want really share my schema.

Expected behavior I don’t expect a ‘A schema MUST have a ‘query’ operation defined’ error to pop up when there is a type Query in the schema

Version and Environment Details Operation system: Win 10 IDE name and version: Webstorm 2020.3.2 Plugin version: 2.9.1

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:7
  • Comments:12

github_iconTop GitHub Comments

8reactions
goktugercecommented, Feb 13, 2022

@vepanimas

I experience this issue on Webstorm 2021.3.2 and plugin version 3.1.2, even with the simplest example of relay-schema.graphql and .graphqlconfig:

image

4reactions
vepanimascommented, Jul 20, 2021

Unfortunately, this is a common error that occurs when the schema could not be built for some reason. I’ve improved error handling and logging in the upcoming version that I’ll release soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A schema MUST have a 'query' operation defined Error. But I ...
I have added my schema to a .graphql file in my main project directory. I now get this error: This is very weird...
Read more >
GraphQL: A schema must have a query operation defined
I'm new to GraphQL, what should the query be set to if the actual query operation only has a mutation at the root...
Read more >
GraphQL schema basics - Apollo GraphQL Docs
This schema defines a hierarchy of types with fields that are populated from your back-end data stores. The schema also specifies exactly which...
Read more >
admin endpoint not working for me - Discuss Dgraph
A schema MUST have a query` operation defined. This is very weird because there is a type Query in the result of the...
Read more >
Schemas and Types - GraphQL
Every GraphQL service defines a set of types which completely describe the set of possible data you can query on that service. Then,...
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