gatsby: Regression: `setNodeField` in plugin `index.js` file value is always `null`

Description

I’m trying to use setNodeField in a plugin of mine. However, instead of the value being set, there is simply null being set for the field’s value. This code previously worked, but sometime recently on upgrading the gatsby versions, it does not work any longer, which is why I feel that this is a regression.

Steps to reproduce

https://github.com/unicorn-utterances/unicorn-utterances/tree/integration

https://github.com/unicorn-utterances/unicorn-utterances/blob/integration/gatsby-config.js#L65

https://github.com/unicorn-utterances/unicorn-utterances/tree/integration/plugins/count-inline-code

https://github.com/unicorn-utterances/unicorn-utterances/blob/integration/plugins/count-inline-code/index.js

If you add console.log(props), you should should see a value for inlineCount

https://github.com/unicorn-utterances/unicorn-utterances/blob/integration/src/templates/blog-post.tsx#L16

Clear steps describing how to reproduce the issue. Please please please link to a demo project if possible, this makes your issue much easier to diagnose (seriously).

How to Make a Minimal Reproduction: https://www.gatsbyjs.org/contributing/how-to-make-a-reproducible-test-case/

Expected result

What should happen?

The value set here:

https://github.com/unicorn-utterances/unicorn-utterances/blob/integration/plugins/count-inline-code/index.js#L21

Should be applied to the field value

Actual result

The value is null, even though I can add a console.log to the plugin that shows the correct value

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

 System:
    OS: Windows 10 10.0.18363
    CPU: (12) x64 AMD Ryzen 5 1600 Six-Core Processor
  Binaries:
    Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.449.0
  npmPackages:
    gatsby: ^2.19.43 => 2.19.43
    gatsby-image: ^2.2.43 => 2.2.43
    gatsby-plugin-feed: ^2.3.28 => 2.3.28
    gatsby-plugin-google-analytics: ^2.1.37 => 2.1.37
    gatsby-plugin-lunr: ^1.5.2 => 1.5.2
    gatsby-plugin-manifest: ^2.2.47 => 2.2.47
    gatsby-plugin-offline: ^3.0.40 => 3.0.40
    gatsby-plugin-prefetch-google-fonts: ^1.4.3 => 1.4.3
    gatsby-plugin-react-helmet: ^3.1.23 => 3.1.23
    gatsby-plugin-react-svg: ^3.0.0 => 3.0.0
    gatsby-plugin-robots-txt: ^1.5.0 => 1.5.0
    gatsby-plugin-sass: ^2.1.30 => 2.1.30
    gatsby-plugin-sharp: ^2.4.12 => 2.4.12
    gatsby-plugin-sitemap: ^2.2.29 => 2.2.29
    gatsby-plugin-transition-link: ^1.18.0 => 1.18.0
    gatsby-plugin-typescript: ^2.2.3 => 2.2.3
    gatsby-remark-autolink-headers: ^2.1.25 => 2.1.25
    gatsby-remark-copy-linked-files: ^2.1.39 => 2.1.39
    gatsby-remark-external-links: 0.0.4 => 0.0.4
    gatsby-remark-images: ^3.1.49 => 3.1.49
    gatsby-remark-images-medium-zoom: ^1.4.0 => 1.4.0
    gatsby-remark-prismjs: ^3.3.35 => 3.3.35
    gatsby-remark-responsive-iframe: ^2.2.33 => 2.2.33
    gatsby-remark-video: ^1.2.5 => 1.2.5
    gatsby-source-filesystem: ^2.1.55 => 2.1.55
    gatsby-transformer-json: ^2.2.27 => 2.2.27
    gatsby-transformer-remark: ^2.6.58 => 2.6.58
    gatsby-transformer-sharp: ^2.3.18 => 2.3.18

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (10 by maintainers)

Most upvoted comments

@crutchcorn I confirmed that the behavior is different between build and develop. Not sure yet what the cause is, but I’m thinking about it.