Search code examples
gatsbynetlifyvercel

Gatsby : image load then disapear on netlify. Works fine on my computer with gatsby develop and works fine on Zeit


I made a basic blog to test Gatsby and Netlify CMS.

I have a very strange problem.

The logo of the blog disappear when the page is fully loaded. This happened only on Netlify. With the "Gatsby Develop" command, there is no problems.

I tested to host the blog with Zeit, and the pictures doesn't disappear.

Netlify : https://wonderful-dubinsky-d2e0f3.netlify.com/ Zeit : https://recettes-ecru.now.sh/

Both website use the same Github repository.


Solution

  • Finally i discovered that the problem was related to service worker. I was using gatsby-plugin-offline. This plugin makes a Gatsby site work offline by using a service worker.

    Browsers cache service workers for 24 hours by default, and don’t update them when you reload your page.

    After unregistering my service worker, the problem was solved.

    Useful reading here : https://community.netlify.com/t/common-issue-understanding-unregistering-service-workers/145

    How to uninstall a service worker : https://love2dev.com/blog/how-to-uninstall-a-service-worker/