Gatsby: Querying timeToRead on mdx throws gatsby-plugin-mdx: Error querying the `html` field

Created on 6 May 2020  路  4Comments  路  Source: gatsbyjs/gatsby

Description

Querying for timeToRead on mdx nodes recently started throwing in gatsby develop

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

Maybe there's been a regression here?

Steps to reproduce

Applying this query to an .mdx file throws the above error. Remove timeToRead and it runs.

import { graphql } from 'gatsby'

export const query = graphql`
  fragment post on Mdx {
    frontmatter {
      title
      slug
      date(formatString: "MMM D, YYYY")
      tags
      }
    }
    excerpt(pruneLength: 200)
    timeToRead
    body
  }

Environment

 System:
    OS: macOS 10.15.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.1.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 81.0.4044.129
    Firefox: 75.0
    Safari: 13.1
  npmPackages:
    gatsby: 2.20.26 => 2.20.26 
    gatsby-image: 2.3.4 => 2.3.4 
    gatsby-plugin-algolia: ^0.8.0 => 0.8.1 
    gatsby-plugin-catch-links: 2.2.3 => 2.2.3 
    gatsby-plugin-favicon: ^3.1.6 => 3.1.6 
    gatsby-plugin-feed: ^2.5.0 => 2.5.0 
    gatsby-plugin-google-analytics: 2.2.4 => 2.2.4 
    gatsby-plugin-lodash: ^3.2.1 => 3.3.0 
    gatsby-plugin-manifest: 2.3.5 => 2.3.5 
    gatsby-plugin-mdx: ^1.1.6 => 1.2.4 
    gatsby-plugin-netlify-cache: ^1.2.0 => 1.2.0 
    gatsby-plugin-offline: 3.1.4 => 3.1.4 
    gatsby-plugin-react-helmet: 3.2.4 => 3.2.4 
    gatsby-plugin-sharp: 2.5.6 => 2.5.6 
    gatsby-plugin-styled-components: ^3.2.1 => 3.3.0 
    gatsby-remark-autolink-headers: ^2.2.1 => 2.3.0 
    gatsby-remark-code-titles: ^1.1.0 => 1.1.0 
    gatsby-remark-copy-linked-files: ^2.2.1 => 2.3.1 
    gatsby-remark-embed-video: 2.0.1 => 2.0.1 
    gatsby-remark-emojis: ^0.4.2 => 0.4.2 
    gatsby-remark-images: 3.2.4 => 3.2.4 
    gatsby-remark-katex: ^3.2.1 => 3.3.0 
    gatsby-remark-responsive-iframe: 2.3.3 => 2.3.3 
    gatsby-remark-smartypants: 2.2.3 => 2.2.3 
    gatsby-remark-sub-sup: ^1.0.0 => 1.0.0 
    gatsby-remark-vscode: ^2.0.3 => 2.0.3 
    gatsby-source-filesystem: 2.2.4 => 2.2.4 
    gatsby-transformer-sharp: 2.4.6 => 2.4.6 
    gatsby-transformer-yaml: 2.3.3 => 2.3.3 

Related Issues

Seems to have been reported first by @brandonpittman in #17175.

bug

Most helpful comment

All 4 comments

same issue error dissapeared after updates.

@johnny-mh Thanks for the hint! I ran yarn upgrade -L and the error is gone. Do you know which commit resolved the issue?

@janosh Sorry. I don't know 馃槶

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

brandonmp picture brandonmp  路  3Comments

totsteps picture totsteps  路  3Comments

KyleAMathews picture KyleAMathews  路  3Comments