"TypeError: Failed to fetch" reported over and overe

I’m having huge amounts of this error as well.

It’s very frustrating that the logged errors do not show which URL was being fetched.
But this is just how the fetch exception handling works out of the box

An example: bring up your devTools on any site and run this piece of code:

    fetch("http://something-that-does-not-exist")
        .then(function(x) {
            console.log("Success:", x);
        }).catch(function(e) {
            console.error(e);
        });

You’ll see that the exception logged is nothing more than
TypeError: Failed to fetch

So unfortunately, the error messages used by fetch simply do not convey any more info than that.

I would love it if there was some easy way to log the URL which was being fetched, but as it stands this is the default message.

When it comes to my site - I do run a lot of 3rd party ads - and I have to assume they are responsible for part of the failed fetches.
But it IS really scary to know that fetches are failing without a clue as to which URL they were attempting to fetch.

@sachinkrgupta : Thanks, your reply helped to realise possible “natural causes” for this event.

2 Likes