Gatsby: GraphQL query error since gatsby-transformer-remark 2.7.4 release

Created on 23 Apr 2020  路  6Comments  路  Source: gatsbyjs/gatsby

Description

Build fail when gatsby-transformer-remark is upgraded _(from either 2.6.59 or 2.7.3)_ to 2.7.4

(Issue may be related to 82c05aa)

Steps to reproduce

As the issue seems to rely on async processing and depending on amount of GraphQL nodes to process, I wasn't able to create a minimal reproduction test case. But the project I'm working on is open source, so you may reproduce the error with it:
Build may take several minute to complete

$ git clone --branch test-case --depth=1 https://github.com/solagro/awa.git
$ cd awa
$ npm ci && npm run build
$ # Build success

$ npm i [email protected]
$ npm run clean && npm run build
$ # Build fail

Expected result

Successfull build

Actual result

Build error

image

[...]

success onPostBootstrap - 0.009s
info bootstrap finished - 17.681 s
success Building production JavaScript and CSS bundles - 55.534s
success Rewriting compilation hashes - 0.007s

 ERROR #85901  GRAPHQL

There was an error in your GraphQL query:

Expected node, not `[object Object]`

   1 | query tmpawasrccomponentsClimateObservationsJs3511084170($gridCode: String, $sourceType: String, $language: String) {
   2 |   allGridPointData(filter: {gridCode: {eq: $gridCode}, sourceType: {eq: $sourceType}}, sort: {fields: [gridCode, dataType]}) {
   3 |     nodes {
   4 |       dataType
   5 |       json
   6 |     }
   7 |   }
   8 |   allTexts: allMarkdownRemark(sort: {fields: fileAbsolutePath}, filter: {frontmatter: {sourceType: {eq: $sourceType}, locale: {eq: $language}}}) {
   9 |     nodes {
> 10 |       html
     |       ^
  11 |       frontmatter {
  12 |         dataType
  13 |       }
  14 |     }
  15 |   }
  16 | }
  17 |

File path: /tmp/awa/src/components/ClimateObservations.js
Url path: /en/map/100132/climate-observations
Plugin: none


 ERROR #85901  GRAPHQL

There was an error in your GraphQL query:

Expected node, not `[object Object]`

   1 | query tmpawasrccomponentsClimateObservationsJs3511084170($gridCode: String, $sourceType: String, $language: String) {
   2 |   allGridPointData(filter: {gridCode: {eq: $gridCode}, sourceType: {eq: $sourceType}}, sort: {fields: [gridCode, dataType]}) {
   3 |     nodes {
   4 |       dataType
   5 |       json
   6 |     }
   7 |   }
   8 |   allTexts: allMarkdownRemark(sort: {fields: fileAbsolutePath}, filter: {frontmatter: {sourceType: {eq: $sourceType}, locale: {eq: $language}}}) {
   9 |     nodes {
> 10 |       html
     |       ^
  11 |       frontmatter {
  12 |         dataType
  13 |       }
  14 |     }
  15 |   }
  16 | }
  17 |

File path: /tmp/awa/src/components/ClimateObservations.js
Url path: /en/map/100132/climate-observations
Plugin: none

not finished run queries - 67.894s

Environment

  System:
    OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 12.16.2 - ~/.nvm/versions/node/v12.16.2/bin/node
    npm: 6.14.4 - ~/.nvm/versions/node/v12.16.2/bin/npm
  Languages:
    Python: 2.7.18 - /usr/bin/python
  Browsers:
    Firefox: 76.0b7
  npmPackages:
    gatsby: ~2.20.29 => 2.20.29
    gatsby-image: ~2.3.4 => 2.3.4
    gatsby-plugin-google-analytics: ~2.2.4 => 2.2.4
    gatsby-plugin-manifest: ~2.3.6 => 2.3.6
    gatsby-plugin-material-ui: ~2.1.6 => 2.1.6
    gatsby-plugin-modal-routing: ^1.1.0 => 1.1.0
    gatsby-plugin-netlify: ~2.2.3 => 2.2.3
    gatsby-plugin-netlify-cms: ~4.2.4 => 4.2.4
    gatsby-plugin-offline: ~3.1.4 => 3.1.4
    gatsby-plugin-react-helmet: ~3.2.4 => 3.2.4
    gatsby-plugin-remove-serviceworker: ~1.0.0 => 1.0.0
    gatsby-plugin-robots-txt: ~1.5.0 => 1.5.0
    gatsby-plugin-sharp: ~2.5.6 => 2.5.6
    gatsby-plugin-sitemap: ~2.3.5 => 2.3.5
    gatsby-plugin-uninline-styles: ~0.2.0 => 0.2.0
    gatsby-plugin-web-font-loader: ~1.0.4 => 1.0.4
    gatsby-remark-external-links: 0.0.4 => 0.0.4
    gatsby-source-filesystem: ~2.2.4 => 2.2.4
    gatsby-transformer-json: ~2.3.3 => 2.3.3
    gatsby-transformer-remark: ~2.7.4 => 2.7.4
    gatsby-transformer-sharp: ~2.4.6 => 2.4.6
  npmGlobalPackages:
    gatsby-transformer-remark: 2.7.4
    gatsby: 2.20.27

stale? confirmed bug

Most helpful comment

Ah, seems like this was already discovered ( https://github.com/gatsbyjs/gatsby/pull/21188#issuecomment-618494200 ) and fixed ( https://github.com/gatsbyjs/gatsby/pull/23427 ) in master, but not yet published to npm. I will publish this tomorrow (finishing for today)

All 6 comments

I can definitely reproduce, but it seems unreasonably difficult to debug what exactly is happening - for some reason attaching debugger makes the problem not reproducible anymore

Adding at least stack trace of where the error happens:

Expected node, not `[object Object]`



  Error: Expected node, not `[object Object]`

  - one.js:21 one
    [i23426]/[hast-util-to-html]/lib/one.js:21:11

  - index.js:28 toHTML
    [i23426]/[hast-util-to-html]/lib/index.js:28:10

  - extend-node-type.js:369 getHTML
    [i23426]/[gatsby-transformer-remark]/extend-node-type.js:369:22

  - next_tick.js:68 process._tickCallback
    internal/process/next_tick.js:68:7

More to follow

Ah, seems like this was already discovered ( https://github.com/gatsbyjs/gatsby/pull/21188#issuecomment-618494200 ) and fixed ( https://github.com/gatsbyjs/gatsby/pull/23427 ) in master, but not yet published to npm. I will publish this tomorrow (finishing for today)

So for today, please pin to previous gatsby-transformer-remark, and next publish should fix this as well.

I applied same fix from https://github.com/gatsbyjs/gatsby/pull/23427 locally and couldn't reproduce the problem anymore.

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 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. You can also add the label "not stale" to keep this issue open!
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! 馃挭馃挏

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.
Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
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 again for being part of the Gatsby community! 馃挭馃挏

Was this page helpful?
0 / 5 - 0 ratings

Related issues

signalwerk picture signalwerk  路  3Comments

ghost picture ghost  路  3Comments

theduke picture theduke  路  3Comments

brandonmp picture brandonmp  路  3Comments

andykais picture andykais  路  3Comments