Search code examples
google-analyticsnext.jsprogressive-web-appsnext-pwa

Progressive Web App: The FetchEvent for "<URL>" resulted in a network error response: the promise was rejected


I am seeing the following errors in the console of my PWA:

  1. The FetchEvent for "https://static.cloudflareinsights.com/beacon.min.js" resulted in a network error response: the promise was rejected.
  2. The FetchEvent for "https://www.google-analytics.com/analytics.js" resulted in a network error response: the promise was rejected.

It seems that external scripts have problems being fetched by workbox? The website is a next.js app and i am using next-pwa to turn it into a PWA. Here is the pwa-config for next-pwa: next-pwa config

Does anyone know how to fix this?


Solution

  • This is fairly common if you have a ad/tracking blocker extension installed, or if your browser has built-in blocking. A Workbox-powered service worker will not do anything to work around this blocking.