Home
Support Forums

Netlify-plugin-gatsby-cache deleting random blog pages on every deploy

We’ve been experiencing various broken links for a gatsby site, but only for blog posts. We’re using netlify-plugin-gatsby-cache and when looking at the logs at the end of the build, there’s always a section like this:

info Deleted pages:
Deleted page: /blog/how-planning-can-improve-your-mental-health
Deleted page: /blog/8-easy-productivity-tips-from-billionaires
Deleted page: /blog/here-is-how-4-day-work-week-can-boost-productivity-microsoft-example
Deleted page: /blog/7-techniques-to-measure-your-goal-progress
Deleted page: /blog/8-effective-productivity-tips-of-the-ultra-successful
Deleted page: /blog/your-best-guide-to-becoming-successful-factors-that-lead-to-a-failure
Deleted page: /blog/time-management-vs-attention-management-procrastination
Deleted page: /blog/6-powerful-rules-for-success
Deleted page: /blog/how-to-switch-from-paper-planning-to-digital
Deleted page: /blog/4-productivity-hacks-to-make-you-more-successful
Deleted page: /blog/your-ultimate-guide-to-setting-smart-goals
Deleted page: /blog/7-elon-musk-productivity-tips-and-advice
Deleted page: /blog/7-reasons-to-combine-paper-and-digital-planners
Deleted page: /blog/ten-tips-to-plan-a-personalized-agenda
Deleted page: /blog/15-ways-to-save-money-living-on-a-tight-budget
Deleted page: /blog/6-tips-to-manage-procrastination-effectively
Deleted page: /blog/how-to-form-a-new-habit
Deleted page: /blog/is-now-the-best-time-to-start-a-side-hustle

However, for each build, this list is seemingly random. Note: all blog pages are coming from Prismic and are fully published. If I run two builds back-to-back, each build will have a separate list of deleted pages, each leading to a 404 page.

I’ve also logged each page handle and confirmed that they are all coming through from Prismic in gatsby-node.js when generating an array of paths to build pages from. Also not receiving any errors from page-level graphql exports during the HTML render process.

Any ideas what may be causing this or how to troubleshoot it?

Thanks

HI there, @proton :wave:

Thanks for reaching out about this! Can you share your netlify site name and repo as well? We would be more than happy to look into this further.

Hey there, @proton :wave:

Are you still facing this issue? If you are, can you try the new plugin and redeploy? That should work.

Hey @hillary ,

Did you receive my PM with the repo info?

Also, I did try the latest gatsby-plugin-netlify and it hasn’t solved the issue. I also changed from the Gatsby Cache plugin to Essential Gatsby, but that hasn’t solved the issue either.

Hey there, @proton :wave:

Thanks so much for the ping on that. We don’t typically check DMs, but I have gone in and checked and I do have the site information you sent over. As this debugging is a bit outside of my wheelhouse, I have looped in the Support team for next steps. Stay tuned!

Thanks, appreciate it :slight_smile:

I forgot to mention - and I hope this helps - that we are pulling different pages from Prismic, not just blog pages. However, only blog pages are being deleted.

Hey there, Proton :wave:

Thanks for your patience here! Two requests:

  1. Can you please try using the netlify-plugin-gatsby plugin (link here)? It maintains the cache, and supports gatsby serverless functions as Netlify functions. I see above you tried the gatsby-plugin-netlify. I am curious if this plugin switch will get you on the right track.
  2. If that doesn’t work, can you please create a reproduction repo that can be shared publicly? This will allow me to share it with the right teammates while not impacting the privacy needed for your project repo.

Thanks!

Hey @hillary ,

I gave that a shot, following the directions and adding netlify-plugin-gatsby to netlify.toml. Also removed gatsby-plugin-netlify, but the problem still persists.

I’m noticing something strange. Part of the build process seems to be loading netlify-plugin-gatsby-cache and then also recommends removing it.

❯ Loading plugins
   - netlify-plugin-gatsby-cache@0.3.0 from Netlify app
   - @netlify/plugin-gatsby@1.0.3 from netlify.toml and package.json

────────────────────────────────────────────────────────────────
  1. onPreBuild command from netlify-plugin-gatsby-cache        
────────────────────────────────────────────────────────────────

Found a Gatsby cache. We’re about to go FAST. ⚡️

(netlify-plugin-gatsby-cache onPreBuild completed in 11.3s)

────────────────────────────────────────────────────────────────
  2. onPreBuild command from @netlify/plugin-gatsby             
────────────────────────────────────────────────────────────────

Found a Gatsby cache. We’re about to go FAST. ⚡️
Add `gatsby-plugin-netlify` to `gatsby-config.js` if you would like to support Gatsby redirects. 🎉
The plugin 'netlify-plugin-gatsby-cache' is no longer required and should be removed.

It says netlify-plugin-gatsby-cache@0.3.0 from Netlify app, however I don’t have any active plugins within Netlify except for the one you recommended.

Just want to check on this before I start reproducing a problem in a public repo because it’s going to take quite a bit of work to do that.

That likely means from the Netlify UI. Do you have any plugins listed here?

@coelmay,

That’s what I was thinking, which adds to the confusion because I definitely have zero plugins installed in the Netlify UI. I uninstalled it about 30 min ago and it’s still persisting for builds.

hey proton, we had another chat with the team and have the following recommendations for you, can you try these and see what happens?

  1. it looks like you have both plugins installed - can you try disabling the original plugin, and just leave the new one, and see if that fixes thins?

  2. if that doesn;t do anything, please remove both plugins and see if that creates any changes? If you need more build time for a longer gatsby build, let us know and we can make that happen for you.

the plugin does not have the capability to delete things, says the person who worked on it, also! so that’s good news.

let us know how you get on.

1 Like

Hi @perry, thanks for the offer, but I don’t think we’ll need longer build times for this site. We just need to make sure that all pages are available.

I can’t find any evidence of both plugins being installed, yet it still runs them both.

  • package.jsongatsby-plugin-netlify was removed
  • Netlify UI → zero plugins are installed
  • netlify.toml → only one plugin is specified, @netlify/plugin-gatsby
  • gatsby-config.js → zero plugins related to Netlify exist

However, I still see (using Netlify Cli) both plugins loading.

❯ Loading plugins
   - netlify-plugin-gatsby-cache@0.3.0 from Netlify app
   - @netlify/plugin-gatsby@1.0.3 from netlify.toml and package.json

Interestingly, using the Netlify build environment instead of Netlify Cli, it only loads one plugin

❯ Loading plugins
1:17:52 PM:    - @netlify/plugin-gatsby@1.0.3 from netlify.toml and package.json

Good news is that when building within Netlify, I no longer see those posts deleted. Confusing news is that Netlify Cli (netlify build) won’t stop loading both plugins and the problem persists in that context.

I would say there is something in your local configuration used with Netlify CLI that is amiss. Suggest checking all local configuration files (e.g. package.json, gatsby-config.js, etc.) to see if the plugins are listed.

Maybe it is something with my local setup, but I am 100% certain that gatsby-plugin-netlify is not longer part of the project, however it’s still being loaded.

Also, using the cli it says the package comes from “Netlify App”, which indicates it’s being delivered from Netlify UI. Is that correct?

That sounds correct.

If you run netlify build --offline does it still load? (hint: it shouldn’t)

When I use the --offline flag it doesn’t load both, just the correct one.

Hey @proton , can you try creating a new site to see if this issue can be reproduced? You can try connecting the same repo to the new site and link the CLI to it. This will help indicate if the issue is related to the CLI(by the way, can you try using the latest version of the CLI if you aren’t doing so already).

You may also want to check out our recommended workflow to manage git tracking plugin-generated files and see if that helps.

Let us know how you get on.

1 Like

Hey @audrey ,

Today I’m working on creating a duplicate, public repo to share with you, as using the other plugin hasn’t fixed the problem unfortunately. Will update soon

1 Like

Here is a new repo with a minimal reproduction, now deploying at affectionate-curie-46aff8.netlify.app

Notes:

  • The issue of deleted blog posts is still happening which you can see toward the end of the build
  • With this new repo, the CLI isn’t trying to load the extra plugin

Thanks for the help