Cache Issue on main domain after changes

Hi guys,

yesterday I merged a preview deploy branch with a bunch of changes into the master production branch for the site https://leconturbanti.netlify.app/ . (the main custom domain is www.leconturbanti.it)

Although many customers are experiencing cache issues: old site is loaded, or new site is loaded but netlify functions are not working, others are experiencing in Safari an error regarding SSL.

I also tried to send a request to renew the SSL.

Personally in my device everything works fine, but indeed for a bunch of other people things are not working.

What can I do?

You’re using a service worker. I’d guess the first suspect to be that. Try telling the people to remove the service worker and retry.

Is there a solution only on my side without telling people to do something they might not be able to do?

I asked you to tell people to unregister the service worker and try just to be sure it’s that what’s causing the issue. However, here’s a support guide which will guide you on how to remove the service worker from users’ device by adding some code on your website: [Support Guide] Understanding & unregistering service workers

Once you push these changes, the service worker should be uninstalled and any subsequent reloads should show the updated content.

Will unregistering the service worker prevent the PWA from working?

Yes it will, as a SW is a requirement for a PWA to be installable.

And what about people who already have it installed?
So the alternative is to wait 24h in order to let the cache expire?

Unregistering a SW would remove the service worker immediately, but not its cache. You’d have to rely on JavaScript for that. However, since the SW is removed, it won’t be serving files from the cache anymore.

The problem is, if suppose you’ve your home page cached (say index.html), and service worker is serving it from the cache every time it’s requested, you probably won’t be able to unregister the service worker. This is because, the service worker would serve the index.html from its cache and thus, the updated version won’t be requested from the network which will have the script to unregister it. In such a case, you can create a new file, say yourwebsite.com/unregisterSW.html and add the script to that. Then you’d have to tell the users to visit that page.

Sorry for all the questions but I’ve never experienced something like this and im trying to understand.
So let’s say I add this script to unregister the sw, what do I need to do after that in order to register that again and make everything like before?

You’ll have to add a line like navigator.serviceWorker.register('/sw.js'); which would register your SW again.

OK.

So i guess I’ll try to wait 24h, then again if tomorrow people are experiencing issues again, I’ll try the JS snippet solution.

Just to clarify a few things.

I’m using Nuxt with the PWA module. In the PWA module docs (https://pwa.nuxtjs.org/workbox), there is a few option that maybe could be useful, for example setting true cleanupOutdatedCaches could help? Could you take a look and maybe indicate me some options that maybe can help (if any)?

Yes, that would help. That basically adds a config to service worker which would invalidate the outdated cache if the service worker received from the network is different than the one installed. So, on the first load, the content will be served by the old service worker, however once the page loads and the new service worker kicks in, any subsequent page load will use the new cache.

Just wanted to add that if there has been changes made, a service worker would queue them up, once a user has closed all tabs of your site and opens it up again “fresh” the service worker should be collecting the new information. What you can do as a nice interface is when you have a service worker registered upon an update that you can detect you can create a little toast popup saying “There has been an update click here to fetch” etc, which also provides information to the user. You can use the same service worker api to tell the user the application is offline-ready, or if they’re using an outdate version of the site etc etc.

You shouldn’t have to run the unregister yourself in your code, rather you could provide a way for the user to know there is updated information. Which means they can click your notifcation rather than closing all tabs they have open of your site and opening it again. (Which is how you could also refetch the new updated info).

I tried to add this option, but site still gives trouble. What Is strange Is that more often browsers can’t open the website for an SSL error!

This would be nice, but I have not much knowledge about service worker, so i’m wondering how you could achieve this!

I’m not sure how and why you’re getting a SSL error.

I think, if you could share your repo, you’d get better help.

Never happened before, happened from yesterday when i merged the new branch with the new version. The fact is that not everyone are experiencing problems. Let’s say that on 1000 users, 200 users get this error or can’t load the site.

Hi, @sintj. We can troubleshoot the SSL errors. To do this, we need a way to find the failing HTTP requests.

The fastest way to do this is to send us the x-nf-request-id header which we send with every HTTP response.

There more information about this header here:

However, most browsers will close the HTTP connection before this header is sent on SSL negotiation failures. If that header isn’t available for any reason, please send the information it replaces. Those details are:

  • the complete URL requested
  • the IP address for the system making the request
  • the IP address for the CDN node that responded
  • the day and time of the request (with the timezone the time is in)

Once we can identify the SSL failures we can troubleshoot why they occurred. ​Please let us know if there are any other questions for us and we look forward to getting this issue resolved.

I am not able to reproduce the error because on my windows machine everything works without an error (even after deleted cache, service worker, cookies); on my Mac with Safari instead site wouldn’t load (especially after removed cache, sw and cookies), showing "Safari can’t load the page “https://www.leconturbanti.it” because it can’t estabilish a secure connection with the server “www.leconturbanti.it”.
Other clients from other person i asked to check the status of the site doesn’t work. Some of them the site won’t load showing the SSL error right away (even on Chrome mobile, so it’s not only Safari related).

Yesterday for a moment the site loaded on Safari and I took a screenshot of all the errors on Safari before the site crashed:

I would like to point out that this situation regards the custom domain www.leconturbanti.it ONLY. The site at leconturbanti.netlify.app works like a charm for everyone and on every device!