Netlify + Gatsby serves old/cached (pre-Gatsby) version of site

Hi,

I’m not sure if this is a Netlify issue, Gatsby issue, or both.

Since switching my site over to a Gatsby build, whenever I go to my public domain, an old cached version of my site loads first. I have to hard reload to see my updated site.

(MacOS Catalina, Chrome Version 80.0.3987.132)

I have tried clearing all caches and builds but cannot nail down what this issue is. Any assistance would be greatly appreciated!

Site: http://marguerite.io/
Github: https://github.com/margueriteroth/rosie

Thank you,
Marguerite

hey @marguerite, welcome.

Are you seeing this in an incognito window as well? I am wondering if this is a browser caching issue.

Hi @perry, thanks for the reply!

I am not seeing the issue in an incognito window. (:clap:) But clearing the caches don’t seem to work (iirc).

The bigger problem is that it is happening to other people who visit my site, and they just think it hasn’t been updated in x-amount of time. They don’t feel the need to hard refresh.

hmm. if you are seeing the correct version in an incognito window, and others are also seeing the right one, then that basically rules out anything but a local browser issue which we can’t really help you with.

Some ideas: have you tried a different browser?
what happens when you try and view the site on a different device, say, your phone?

Also your dog is cute! :dog:

I’m sorry—I worded that last part strangely. Others are seeing the wrong version now if they had visited my site prior to the Gatsby redesign.

The site displays correctly on my phone and other browsers.

(Thank you! His name is Oscar.)

Maybe it’s caused by an aggressive service worker? I don’t see any, but that doesn’t mean one hasn’t been registered before…

ah, so it could be more wide spread than local.

Seems like maybe I weird question, but humour me: Are the other people who are seeing the old site using the same internet service provider? We had a weeeeird bug a while back where everyone who was using a specific local ISP was having problems. And I assuming these other folks are also clearing their cache?

@tomrutgers has a good point also. Not sure about that. I’m going to wait for a Support Engineer to weigh in.

The issue is happening across ISPs.

I don’t believe I’m using a service worker. How do I more thoroughly check that?

(Checked using the service worker detector chrome extension and nothing is detected.)

have you tried deploying the same code to a completely new site and seeing if that fixes the issue?

That’s a good idea.

I just removed all instances of netlify from marguerite.io's nameservers and deployed the code to marguerite.wtf.

Even with everything removed from marguerite.io, I still see the old, pre-gatsby, version of the site on marguerite.io. So this must be a caching issue with my domain registrar? I use iwantmyname.com. Or a chrome issue :thinking:

so, the content still exists on the cdn nodes - you deploy to origin, and then it gets pushed out to the edge. so that’s actually not surprising. It won’t get deleted unless you delete the netlify site.

Is the .wtf site the correct site, now? This is what i see:

if yes:
I would suggest you delete the netlify site that feeds into marguerite.io through our dashboard, and create a new site, deploy the same code that is on wtf (if that, indeed, is the correct one) and then re-associate the .io domain name with the new netlify site containing the right content.

or, even, just change the site that current site that feeds into the .wtf site to have the .io domain name, if it is indeed the correct one.

1 Like

That seems to have worked! :raised_hands::raised_hands:

Thank you @perry and @tomrutgers for all the help! Much appreciated.

1 Like

If ypu are using the gatsby-plugin-offline you might want to add something like this on gatsby-browser.js:

export const onServiceWorkerUpdateFound = () => {
  window.location.reload();
};

Hi @javierpiedra, welcome to the community! That’s interesting for when you update your Gatsby site but the issue mentioned here was about pre-Gatsby versions of their site so I’m not sure that line of code would help in that case.

Great advice though! Maybe you can write a separate post that shows using that to make sure a Gatsby-based site is always updated even with a serviceworker. Thanks!

1 Like