gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.3k stars 10.31k forks source link

Gatsby-Transformer-Remark -> MARKDOWN can't produce excerpt #20230

Closed stephencweiss closed 4 years ago

stephencweiss commented 4 years ago

Description

When building my Gatsby site, I'm seeing the following errors thrown even though my posts are written in plain Markdown:

On my personal site (github repo) I get it for all of these posts (there's no pattern that I'm seeing that makes them unique):

getBlurb.js:5 {path: "blog/2019-09-02/change-default-shell-zsh/"}
getBlurb.js:5 {path: "blog/2019-11-14/ssh-into-user/"}
getBlurb.js:5 {path: "blog/2019-11-04/useeffect-basics/"}
getBlurb.js:5 {path: "blog/2019-11-03/global-node-package-management/"}
getBlurb.js:5 {path: "blog/2019-04-17/writing-is-the-beginning/"}
getBlurb.js:5 {path: "blog/2019-10-22/cannot-read-property-match/"}
getBlurb.js:5 {path: "blog/2019-09-15/compression-tar-vs-zip-vs-rar-vs-gz/"}
getBlurb.js:5 {path: "blog/2019-09-07/adding-prettier/"}
getBlurb.js:5 {path: "blog/2019-04-30/git-rename-branch-locally-and-remotely/"}
getBlurb.js:5 {path: "blog/2019-01-04/better-form-submissions-with-event-preventdefault-and-htmlformelement-reset/"}
getBlurb.js:5 {path: "blog/2018-08-12/the-best-time-to-get-started-was-yesterday/"}
The GraphQL query from /Users/stephen/_coding/personal/gatsby-bug-repo/bug-repo/src/pages/page-2.js failed.

Errors:
  this[ORDERED_MAP[node.ordered]] is not a function

  GraphQL request:5:9
  4 |       node {
  5 |         excerpt(format: MARKDOWN)
    |         ^
  6 |         fields {
URL path:
  /page-2/
Context:
  {}
Plugin:
  none
Query:
  query indexBlogQuery {
    allMarkdownRemark {
      edges {
        node {
          excerpt(format: MARKDOWN)
          fields {
            slug
          }
          frontmatter {
            title
          }
        }
      }
    }
  }

Steps to reproduce

  1. download the demo repo (https://github.com/stephencweiss/gatsby-bug-repo-transformer-remark-excerpt)
  2. install packages (npm install) and start (npm start)
  3. compare the two pages: Screen Shot 2019-12-19 at 3 23 11 PM Screen Shot 2019-12-19 at 3 23 16 PM

Expected result

MARKDOWN should not fail

Actual result

MARKDOWN fails and no excerpt is generated

Environment

  System:
    OS: macOS 10.15.2
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Shell: 5.7.1 - /usr/local/bin/zsh
  Binaries:
    Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.13.0 - ~/.nvm/versions/node/v12.13.0/bin/npm
  Languages:
    Python: 2.7.17 - /usr/local/bin/python
  Browsers:
    Chrome: 79.0.3945.88
    Safari: 13.0.4
  npmPackages:
    gatsby: ^2.13.2 => 2.18.15
    gatsby-image: ^2.0.22 => 2.2.37
    gatsby-plugin-facebook-pixel: ^1.0.3 => 1.0.3
    gatsby-plugin-feed: ^2.0.8 => 2.3.25
    gatsby-plugin-google-analytics: ^2.1.1 => 2.1.31
    gatsby-plugin-manifest: ^2.0.5 => 2.2.33
    gatsby-plugin-netlify-cache: ^1.2.0 => 1.2.0
    gatsby-plugin-offline: ^2.0.5 => 2.2.10
    gatsby-plugin-react-helmet: ^3.0.0 => 3.1.18
    gatsby-plugin-sharp: ^2.2.1 => 2.3.9
    gatsby-plugin-styled-components: ^3.1.13 => 3.1.16
    gatsby-plugin-typography: ^2.2.0 => 2.3.20
    gatsby-plugin-webpack-bundle-analyzer: ^1.0.5 => 1.0.5
    gatsby-remark-autolink-headers: ^2.1.0 => 2.1.21
    gatsby-remark-copy-linked-files: ^2.0.5 => 2.1.33
    gatsby-remark-embed-video: ^1.7.0 => 1.7.1
    gatsby-remark-images: ^2.0.4 => 2.0.6
    gatsby-remark-prismjs: ^3.0.0 => 3.3.27
    gatsby-remark-responsive-iframe: ^2.0.5 => 2.2.30
    gatsby-remark-smartypants: ^2.0.5 => 2.1.19
    gatsby-source-filesystem: ^2.1.1 => 2.1.42
    gatsby-transformer-remark: ^2.1.6 => 2.6.44
    gatsby-transformer-sharp: ^2.1.3 => 2.3.9
vladar commented 4 years ago

Looks like this is a dependency issue. gatsby-transform-remark depends on remark-stringify@^5.0.0 which has this bug. It has been fixed in remark-stringify@^6.0.0. We need to dump the dependency version but it will likely require a minor release for gatsby-transform-remark.