Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Why do I get TypeError failed to fetch on every page refresh #290

@marcofranssen

Description

@marcofranssen

I'm struggling to resolve the following error on my webblog.

Why do I get TypeError failed to fetch on every page refresh. Only the very first time I load the page it loads without errors. Then on every refresh I get errors.

https://marcofranssen.nl

The FetchEvent for "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" resulted in a network error response: the promise was rejected.
Promise.then (async)
r @ sw.js?t=1576961691623:17
sw.js?t=1576961691623:1 Uncaught (in promise) TypeError: Failed to fetch
(index):1780 GET https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js net::ERR_FAILED
(index):1812 ServiceWorker Register Successfully.

I have been checking this for a while now, but don't have any clue how to resolve.

I hope someone is able to point me in a solution direction.

My code looks as following:

self.addEventListener('install', function () {
  return self.skipWaiting();
});
self.addEventListener('active', function () {
  return self.clients.claim();
});

var precacheUrls = [
  '/',
  '/about/',
  '/git-recipes/',
  '/signing-docker-images-using-docker-content-trust/',
  '/secure-2fa-ssh-and-pgp-using-krypton/',
  '/howto-secure-shell-easily-from-the-terminal/',
  '/manage-go-tools-via-go-modules/',
  '/install-fresh-raspbian-image-on-your-raspberry-pi-part-2/',
];

toolbox.precache(precacheUrls);
toolbox.options = {"networkTimeoutSeconds":5};

toolbox.router.any(/^https:\/\/(www\.google-analytics\.com|pagead2\.googlesyndication\.com)/, toolbox.networkOnly);
toolbox.router.any(/.*\.(js|css|jpg|jpeg|png|gif)$/, toolbox.cacheFirst);
toolbox.router.any(/content.json$/, toolbox.cacheFirst);
toolbox.router.any(/\//, toolbox.networkFirst);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions