Basic troubleshooting Drupal for "cURL ERROR 28: Operation times out after..."

Submitted by Drupalguy on Mon, 11/23/2020 - 14:00

Basic troubleshooting Drupal for "cURL ERROR 28: Operation times out after..."

This is generally a time out connecting to a web resource.

I have found a lot of "fixes" on how to correct this issue but very few on how to isolate where the problem is.  This is especially with Drupal where all you get is this general error:

  • GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 30000 milliseconds with 0 out of 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in GuzzleHttp\Handler\CurlFactory:: createRejection() (line 200 of .../vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php)

This does not give you much information as to what to look for to isolate what to do about the error.  From what I have read this timeout is a communication breakdown but it does not tell you where it is breaking down so we must do more isolation to point us in the right direction. We need to isolate the communication breakdown to the app, the local server, the Internet, or the far end server/application.

These steps should help with that.

  • Test connectivity using cURL from cli on your web-server.
    • This will test the overall connectivity to the far end to verify you are able to connect to the application at the far end. (for example)
      • curl -I http://www.paypal.com/us/home
      • curl -I https://www.paypal.com/us/home
    • if you are successful everything is fine with your communication channel and you will need to look at your module for a connectivity issue.
    • if you are not successful you have a communication channel issue
  • Try to connect w/telnet/port from cli on your web-server
    • This will test connectivity across the internet to verify if the port is connecting to the far end. (for example)
      • telnet www.paypal.com 80
      • telnet www.paypal.com 443
    • if you can connect this means you are successfully connecting to the far end web-server
    • if you cannot connect this means you are being blocked by the web-server of a network resource in between.
    • If you get a "name resolution" failure (or different error related to the url/ip resolution) this means that you are not able to resolve the url to an ip address and that could point to a dns issue.  
  • Check the firewall by disabling it temporarily
    • This will let you know whether the connection is being blocked at your local server or beyond your local server
      • if you can connect this means your firewall is blocking you
      • if you cannot connect it means your communication is leaving your server successfully.