gatsby-plugin-feed stopped working with gatsby-plugin-mdx in Gatsby v3
See original GitHub issueDescription
My website uses MDX via gatsby-plugin-mdx. I’ve recently started the migration to Gatsby v3, and noticed that when I do a build, the RSS feeds fail with the following error message repeated over and over again:
gatsby-plugin-mdx: Error querying the `html` field.
This field is intended for use with RSS feed generation.
If you're trying to use it in application-level code, try querying for `Mdx.body` instead.
Original error:
Error: renderMdxBody was unavailable when rendering html.
ERROR
gatsby-plugin-mdx
[object Object],[object Object]
Steps to reproduce
- Clone and checkout this branch: https://github.com/pedrolamas/pedrolamas.com/tree/gatsby
- Run
yarn && yarn build
and observe the error messages.
That branch is using gatsby-plugin-feed-generator
, but the same error occurs with gatsby-plugin-feed
. If you want to test with it, do the following after:
- Run
yarn remove gatsby-plugin-feed-generator
- Run
yarn add gatsby-plugin-feed
- Edit “gatsby-config.js” and change the whole “gatsby-plugin-feed-generator” entry to this:
{
resolve: `gatsby-plugin-feed`,
options: require('gatsby-plugin-mdx/feed'),
},
- Run
yarn && yarn build
and observe the error messages.
Expected result
The feed file should be generated correctly.
Actual result
Errors are shown and the feed items have no content node in it.
Environment
System: OS: Windows 10 10.0.19043 CPU: (12) x64 Intel® Core™ i7-10750H CPU @ 2.60GHz Binaries: Node: 14.15.1 - ~\AppData\Local\Temp\yarn–1614855258976-0.4757388352035463\node.CMD Yarn: 1.22.10 - ~\AppData\Local\Temp\yarn–1614855258976-0.4757388352035463\yarn.CMD npm: 7.5.2 - C:\Program Files\nodejs\npm.CMD Languages: Python: 2.7.15 Browsers: Edge: Spartan (44.19041.423.0), Chromium (88.0.705.81), ChromiumDev (90.0.810.1) npmPackages: gatsby: ^3.0.0 => 3.0.1 gatsby-plugin-env-variables: ^2.0.0 => 2.0.0 gatsby-plugin-eslint: ^3.0.0 => 3.0.0 gatsby-plugin-feed: ^3.0.0 => 3.0.0 gatsby-plugin-google-analytics: ^3.0.0 => 3.0.0 gatsby-plugin-image: ^1.0.0 => 1.0.0 gatsby-plugin-manifest: ^3.0.0 => 3.0.0 gatsby-plugin-mdx: ^2.0.0 => 2.0.0 gatsby-plugin-netlify: ^3.0.0 => 3.0.0 gatsby-plugin-offline: ^4.0.0 => 4.0.0 gatsby-plugin-react-helmet: ^4.0.0 => 4.0.0 gatsby-plugin-robots-txt: ^1.5.5 => 1.5.5 gatsby-plugin-sass: ^4.0.0 => 4.0.0 gatsby-plugin-sharp: ^3.0.0 => 3.0.0 gatsby-plugin-sitemap: ^3.0.0 => 3.0.0 gatsby-plugin-twitter: ^3.0.0 => 3.0.0 gatsby-remark-acronyms: ^1.1.2 => 1.1.2 gatsby-remark-copy-linked-files: ^3.0.0 => 3.0.0 gatsby-remark-images: ^4.0.0 => 4.0.0 gatsby-remark-responsive-iframe: ^3.0.0 => 3.0.0 gatsby-remark-smartypants: ^3.0.0 => 3.0.0 gatsby-source-filesystem: ^3.0.0 => 3.0.0 gatsby-transformer-sharp: ^3.0.0 => 3.0.0 gatsby-transformer-yaml: ^3.0.0 => 3.0.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:5 (4 by maintainers)
Top GitHub Comments
Thanks for report and reproduction - just opened PR with fix ( https://github.com/gatsbyjs/gatsby/pull/30158 )
In my case, the build is successful now after updating to
gatsby@3.1.1
andgatsby-plugin-feed@3.1.0
but HTML is still missing in the RSS feed.Steps to reproduce
yarn
. This repo should be able to develop and buildgatsby-plugin-feed
at the bottom of thegatsby-config.js
gatsby serve
, rss.xml file is still missing the HTML content.Expected result
/rss.xml should contain HTML code for each blog post content
Actual result
HTML cannot be found in RSS feed after
gatsby serve
.Error message shows up when
gatsby build
Environment