GraphQL "fields" and "navigationLabel" Query Error
Opened this issue · 0 comments
shennan commented
Seems like a nice idea for a library. Only issue is I can't get it working and get a GraphQL query error on first use:
There was an error in your GraphQL query:
Cannot query field "fields" on type "Mdx".
If you don't expect "fields" to exist on the type "Mdx" it is most likely a typo.
However, if you expect "fields" to exist there are a couple of solutions to common problems:
- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "fields" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content")
It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Mdx":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
File: /Users/user/gatsby-project/node_modules/@pauliescanlon/gatsby-mdx-routes/components/MdxRoutes/MdxRoutes.js
There was an error in your GraphQL query:
Cannot query field "navigationLabel" on type "MdxFrontmatter".
If you don't expect "navigationLabel" to exist on the type "MdxFrontmatter" it is most likely a typo.
However, if you expect "navigationLabel" to exist there are a couple of solutions to common problems:
- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "navigationLabel" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content")
It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "MdxFrontmatter":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
File: /Users/user/gatsby-project/node_modules/@pauliescanlon/gatsby-mdx-routes/components/MdxRoutes/MdxRoutes.js
Perhaps I need navigationLabel
in the front matter of all my MDX files? Still, would be good to have it not break when this wasn't the case.
The other strange thing is that I continue to get this error even after I've removed your plugin from my gastby-config.js
file. To get my project back to a fit state I had to remove your library from my package.json
, delete all node_modules
and yarn.lock
s and then re-install everything.