Extending Mdx nodes results in other fields (e.g. body, excerpt) not being available
See original GitHub issueDescription
I’m trying to extend the Mdx
node type created by gatsby-plugin-mdx
, with gatsby-node
’s createResolvers
or createSchemaCustomization
API. In either case, this results in the body
and excerpt
fields (as well as others) not being available on the Mdx
node anymore.
Steps to reproduce
Simply adding a field to Mdx
will cause it to break, e.g.:
export const createSchemaCustomization = async ({ actions: { createTypes } }) => {
const typeDefs = `
type Mdx implements Node {
foo: String!
}
`;
createTypes(typeDefs);
};
Expected result
I expect the new field foo
to be available alongside all the other fields (like body
and excerpt
).
Actual result
The new field is available, but body
, excerpt
and other important field are not:
This results in errors when trying to query for these fields.
ERROR #85923 GRAPHQL
There was an error in your GraphQL query:
Cannot query field "body" on type "Mdx".
Environment
System:
OS: Linux 5.7 Arch Linux
CPU: (16) x64 AMD Ryzen 7 3800X 8-Core Processor
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 12.16.1 - /tmp/yarn--1596878937010-0.33041929112915125/node
Yarn: 1.22.4 - /tmp/yarn--1596878937010-0.33041929112915125/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
Languages:
Python: 3.8.5 - /usr/bin/python
Browsers:
Firefox: 79.0
npmPackages:
gatsby: ^2.24.36 => 2.24.36
gatsby-plugin-canonical-urls: ^2.3.4 => 2.3.4
gatsby-plugin-catch-links: ^2.1.25 => 2.3.5
gatsby-plugin-favicons: ^1.0.4 => 1.0.4
gatsby-plugin-git-clone: ^0.1.0 => 0.1.0
gatsby-plugin-matomo: ^0.8.0 => 0.8.3
gatsby-plugin-mdx: ^1.2.34 => 1.2.34
gatsby-plugin-react-helmet-async: ^1.0.15 => 1.0.16
gatsby-plugin-s3: ^0.3.3 => 0.3.3
gatsby-plugin-sharp: ^2.4.5 => 2.6.11
gatsby-plugin-sitemap: ^2.2.27 => 2.4.5
gatsby-plugin-styled-components: ^3.1.19 => 3.3.4
gatsby-plugin-ts-config: ^0.2.3 => 0.2.3
gatsby-plugin-typescript: ^2.4.6 => 2.4.6
gatsby-remark-external-links: ^0.0.4 => 0.0.4
gatsby-remark-images: ^3.1.44 => 3.3.10
gatsby-remark-static-images: ^1.2.1 => 1.2.1
gatsby-source-filesystem: ^2.3.0 => 2.3.11
gatsby-transformer-yaml: ^2.2.25 => 2.4.4
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top Results From Across the Web
gatsby-plugin-mdx
Use the createNodeField action to extend MDX nodes. All new items will be placed under the fields key. You can alias your fields...
Read more >Extending MDX
This article explains how to extend MDX content—specifically, how to transformcontent with plugins.
Read more >Gatsby Changelog | 5.3.0
In PR #36623 we fixed this behavior and any node changes (either by changing local files or through webhook updates) will be reflected...
Read more >Gatsby MDX - how to display excerpts? - Stack Overflow
I googled a lot but couldn't find any guidance. Here is how the GraphiQL query results look like: notice that excerpt is empty...
Read more >Input Parameters of the RESTful Web Service
In REST Web services, the fields that have been marked as “No searchable” cannot be used to filter the results. For view resources,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hiya!
This issue has gone quiet. Spooky quiet. 👻
We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 💪💜
Looks like this was fixed in one of the updates. 👍 Using the following code, I was able to query
foo
, as well asbody
,excerpt
, etc.