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.

[gatsby-source-wordpress]: `options.develop.hardCacheData` does not work if any fields are generated by `createNodeField`

See original GitHub issue

Preliminary Checks

Description

options.develop.hardCacheData does not work if any fields are generated by createNodeField

Reproduction Link

https://github.com/tsdexter/gatsbycreatenodefieldhardcachedatarepro

Steps to Reproduce

  1. clone https://github.com/tsdexter/gatsbycreatenodefieldhardcachedatarepro
  2. npm install
  3. npm run develop
  4. wait for it to build
  5. cmd+c (quit the develop process)
  6. npm run clean
  7. npm run develop a second time

Expected Result

Subsequent develop sessions should build and run

Actual Result

development build fails with error below. Having to turn off this feature really slows down development builds.

Error: Plugins creating nodes can not set data on the reserved field "fields"
      as this is reserved for plugins which wish to extend your nodes.       

      If your plugin didn't add "fields" you're probably seeing this
      error because you're reusing an old node object.

Environment

System:
    OS: Windows 10 10.0.19044
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
  Binaries:
    Node: 14.20.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.17 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 2.7.8 - /c/Python27/python
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.71)
  npmPackages:
    gatsby: ^4.0.0 => 4.19.2 
    gatsby-plugin-image: ^2.0.0 => 2.19.0 
    gatsby-plugin-manifest: ^4.0.0 => 4.19.0 
    gatsby-plugin-offline: ^5.0.0 => 5.19.0 
    gatsby-plugin-react-helmet: ^5.0.0 => 5.19.0 
    gatsby-plugin-sharp: ^4.0.0 => 4.19.0 
    gatsby-source-filesystem: ^4.0.0 => 4.19.0 
    gatsby-source-wordpress: ^6.0.0 => 6.19.0 
    gatsby-transformer-sharp: ^4.0.0 => 4.19.0

Config Flags

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TylerBarnescommented, Sep 12, 2022

Hey @tsdexter, thanks for opening this issue. hardCacheData is marked as an experimental feature because there are many cases where it doesn’t work properly. In this case I would recommend not using it. For development a more effective way to cut down gatsby develop start up times is to use the limit option

You can set a limit to the total number of nodes fetched for each type. Check this example. You can also add a limit for nodes of all types by substituting the typename for __all (so instead of Post in the example).

0reactions
tsdextercommented, Sep 12, 2022

@LekoArts @TylerBarnes I’ve updated the repro to 4.22.1 and the issue still persists…you can’t run develop again until rm -rf .wordpress-cache which defeats the purpose of the feature

Read more comments on GitHub >

github_iconTop Results From Across the Web

createNodeField does not create a field #92 - GitHub
Hi, I am trying to add a field to an existing DatoCMS node but it doesn't work. I have added this code in...
Read more >
Using New Gatsby Source WordPress Plugin - CSS-Tricks
This article is not a step-by-step guide on how to use Gatsby Source WordPress Plugin. Again, that's already available in Gatsby's ...
Read more >
Error with Gatsby plugin Gatsby-Source-Wordpress
js:68:7 warn The gatsby-source-wordpress plugin has generated no Gatsby nodes. Do you need it? success source and transform nodes - 0.327 s ...
Read more >
Sourcing from WordPress - Gatsby
WordPress is a free and open-source content management system (CMS). ... allows a fallback url if WPGRAPHQL_URL is not set in the env,...
Read more >
How To Use WordPress Content with a Gatsby.js Application
Thanks to the starter template you used, the gatsby-source-wordpress plugin will already be installed as a dependency and have a settings entry ...
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