moon indicating dark mode
sun indicating light mode

Add a GraphQL schema for your Gatsby project in Webstorm (JetBrains IDE)

February 16, 2020#GatsbyJS, #Productivity

The JS GraphQL plugin for JetBrains IDEs like Webstorm is very helpful when you are writing your GraphQL queries. But I encountered a problem when trying to discover the endpoints, introspecting the plugin itself:

SchemaProblem{errors=[The object type 'MdxBlogPost' [@-1:-1] field
'excerpt' does not have the same number of arguments as specified via
interface 'BlogPost' [@-1:-1]]}

I don’t know where the error comes from (I’d say the plugin itself) but here is a workaround to make it work!

  1. Install the graphql-cli using npm or yarn: npm install -g graphql-cli or yarn global add graphql-cli
  2. graphql init to create your .graphqlconfig file
  3. graphql get-schema to discover the schema using the cli tool instead of the plugin one.

Now the plugin should be able to help you write your queries properly. I hope it saves you some time!

Subscribe to my newsletter for web development news!

Did this article bring you value? Why not subscribe to my newsletter then!

It's completely spam-free (I'll send it less than once a month) and you can unsubscribe whenever you want!

Hi 👋, I’m Vincent Déniel. I’m a 💻 web developer, a ✍️ cartoonist and a 📝 blogger! You can follow me on Twitter where I’m @vincentdnl or check my about page to learn more about what I do!