ERR_CONNECTION_FAILED in Page Speed Insight

ERR_CONNECTION_FAILED in Page Speed ​​Insight

In this article I am going to tell you several aspects about the Page Speed ​​Insight that I found when trying to solve this error that did not allow me to test the performance of several of my sites.

Error in Page Speed ​​Insight: ERR_CONNECTION_FAILED

When trying to test the performance of several of my sites, Google Page Speed ​​Insight throws an error: it doesn’t say much more than

Lighthouse returned error: FAILED_DOCUMENT_REQUEST. Lighthouse was unable to reliably load the page you requested. Make sure you are testing the correct URL and that the server is properly responding to all requests. (Details: net :: ERR_CONNECTION_FAILED)

Since it is a service that I request from the Google server, I did not expect it to have to do with my computer.

I searched for solutions in google and found very few, many of them blaming me for my site and none really giving in the real solution and I explain to you why

The reasons for the ERR_CONNECTION_FAILED in the Page Speed ​​Insight

The reasons I found searching in google did not solve my problem. I haven’t solved it yet but I found a workaround to get the results. The only three references to this error appear on Reddit, Stack Overflow, and Google Forum for Page Speed ​​Insight.

One mentions that it solved the problem by changing equipment. This already made me think of something. That if that were the case, Page Speed ​​Insight is not a service provided by the Google server, but somehow the machine itself intervenes.

I found an apparent confirmation of this in several aspects that I will tell you later.

The second cause I found searching the internet was the existence of malware that redirected somewhere else. I did not find this to be my case, checking the network addresses I was calling when accessing my site without finding anything strange beyond google analytics.

The third cause is that the site was too slow and did not respond in a reasonable time, this being the most likely option in my case. It also happened to me that sometimes I could access, and get the report, for example at 4.am

The issue of too much delay did not seem reasonable to me either because the error was not a TIMEOUT but an ERR_CONNECTION_FAILED.

In this sense, I assumed that Google’s error was somewhat more polite than that of sites like GTMetrix, where they tell you that you have 30 or 50 urls testing before yours. In google they will not tell you: We do not have an error, but when the processing time took longer than they want to invest in you, they directly throw an error at you and fix yourself.

But it seems that that was not “entirely” the problem either.

My Ways to diagnose the ERR_CONNECTION_FAILED in the Page Speed ​​Insight

To diagnose with the data I had, I tried several alternatives until the last time I found a WorkAroundwithout solving it

Test in another computer1

I tried other computers in my house and kept launching the ERR_CONNECTION_FAILED.

Trying different sites on the same server

I thought about accessing the host. That the host answered the calls irregularly. And since the report consists of several passes, not all were successfully completed, and then the report launched the ERR_CONNECTION_FAILED.

And this brought me more uncertainty. I tried 8 sites on the same server, supposedly it would have the same IP. With 4 sites it threw the exception and with 4 sites it produced the report correctly. This happened not only once but repeatedly.

Unify .htaccess settings for all sites I

unified .htacces. I tried to find differences between one place and another. And nothing. Those who walked well from the beginning kept walking well. Those who went around throwing the bug kept throwing the bug.

Generate a dummy indexNNN.html file

Since most sites are made with WordPress, I wanted to remove WordPress as the cause. I created in the root an html file of type indexNNN.html that has a simple Hello World in a <p> all simple, and kept giving the ERR_CONNECTION_FAILED. The error and non-error sites were the same.

Consult my hosting service

This step was revealing. Although it seemed like a Page Speed ​​Insight mistake, they took care of me and were willing to help me. This gave me a revealing piece of information.

I made the query about a single site. When I mentioned the url, they did the test and Page Speed ​​Insight showed them the report without error. This made me notice that even at the same time, by accessing Page Speed ​​Insight, in one part of the world I was giving an error, and in another part of the world, in another country it was not giving an error.

I called my father, who lives in the same country as me. (If unfortunately I still couldn’t move and I don’t know if it’s too late, they are starting with the expropriation of the first company … but that’s another matter).

Regarding the error, I called my father and he also gave the error. So I assumed that from our region Page Speed ​​Insight launched ERR_CONNECTION_FAILED.

Page Speed ​​Insight and the local machine

These resolution attempts and their results made me strengthen the idea that Page Speed ​​Insight is using my machine to generate the report.

I tried to check it by running checking in the chrome inspect when sending the url in the form of Page Speed ​​Insight. And I noticed that the error was being generated by 4 calls. 2 of which were the submit form. The url that shows has to do with runPageSpeed ​​and one of the parameters is the strategy that for one case is mobile and for the other case desktop.

And I notice that the initiator is lightsight.js.

Chrome lighthouse extension.

In some solution options it had been mentioned to use the chrome lighthouse extension. This extension actually generates the same report. And in my case it happened to me that where the Page Speed ​​Insight form gave me an error, the lighthouse extension also gave me an error.

The lighthouse has an advantage. That not only shows the report of a site sent at the moment, with its url. Rather, the report is actually a json. And if we save the json of the answer and then load it in the lighthouse we can see the detailed report with all its graphics, its colors, and the recommendations.

But the lighthouse did not seem to be the solution until then

The Workaround that I found

I still think that like many other problems, the solution is to move from the country in which I still live for now (even with closed borders). But I found an intermediate solution.

I noticed that the report consists of several sections (like 7 or 8) in addition to all that duplicated, one for mobile and one for desktop.

I also noticed (without anyone telling me) that when I installed the Chrome ligthhouse extension, a tab was added to me in developer mode, which is casually called “lighthouse”.

From that tab you can request the report, such as in Page Speed ​​Insight or by clicking on the lighthouse icon while on the page. But with an additional feature.

On the internal tab of the chrome lighthouse extension in the developer window, you have several checkboxes that allow you to select each of the sections of the report as well as select only mobile or only desktop (or both).

So I decided to get my partial report and many of the sections for both mobile and desktop gave the report with detailed result.

Leave a Reply