question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:23 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jlkiricommented, Mar 25, 2020

@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.

0reactions
LekoArtscommented, Jan 3, 2022

Hi!

I’m closing this as a stale issue as in the meantime Gatsby 4 and related packages were released. You can check our Framework Version Support Page to see which versions currently receive active support.

Please try the mentioned issue on the latest version (using the next tag) and if you still see this problem, open a new bug report. It must include a minimal reproduction.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

how do i solve plugin error for index.js in cypress
I am getting following error for Cypress. The following error was thrown by a plugin. We stopped running your tests ...
Read more >
The index.js file of a plugin - Volumio Documentation
The index.js file of every plugin is where the magic goes on. It has some predefined and mandatory functions and a standardized layout....
Read more >
Enhanced Input Axis Value is always null - Blueprint
Hey all! I started playing around with the Enhanced Input plugin because I loved the functionality described in the documentation.
Read more >
typeError: Cannot set property 'innerText' of null - WordPress.org
I get JS error: typeError: Cannot set property 'innerText' of null when I try. Tried to disable plugins but didn't help…. The page...
Read more >
Fix Cannot Set Property of Null Error in JavaScript - YouTube
Check us out at https://www.skillforge.com The "cannot set property of null " error is a very common JavaScript issue that you may come ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found