Bobcares

Drupal 8 Guzzle Timeout Issue – An Easy Fix

by | Nov 10, 2023

Learn how to fix the Timeout Issue with Guzzle in Drupal 8 migration. Our Drupal Support team is here to help you with your questions and concerns.

How to fix the Timeout Issue with Guzzle in Drupal 8

Drupal 8 migrations can be tricky sometimes. Especially when dealing with HTTP requests that take longer than the default timeout of 30 seconds.

If you have been running into exceptions like “cURL error 28: Operation timed out,” our experts have your back.

Exceptions tend to pop up with HTTP requests exceeding the 30-second limit during a migration operation on a Drupal 8 site.

As a result, the migration is incomplete. Hence, we need a quick fix for the timeout issue.

Fortunately, our experts have a solution for this issue. The secret lies in Drupal’s \Drupal\Core\Http\ClientFactory.

How to fix the Timeout Issue with Guzzle in Drupal 8

 

It is the default mechanism for plugins like Migrate’s HTTP fetching plugin to get a Guzzle client for making HTTP requests. Although this default configuration works, we can modify the timeout setting for lengthier requests.

  1. First, open the \Drupal\Core\Http\ClientFactory file.
  2. Then, head to the section where the default configuration is set (where ‘timeout’ => 30 is defined). Here, we will be able to see a line of code that merges any http_client_config configuration overrides from settings.php.

    $config = NestedArray::mergeDeep($default_config, Settings::get('http_client_config', []), $config);

  3. Now, we can easily change the timeout duration by adding a snippet to our site’s settings.php file.
    For example, to set the default timeout to 60 seconds, we have to add the following:

    settings.php file

Furthermore, we can customize other settings like proxy configurations, headers, or certificate verification with the same approach.

With this easy fix, we will be able to say goodbye to the timeout issue during Drupal 8 migrations.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

In brief, our Support Experts demonstrated how to fix the Timeout Issue with Guzzle with Drupal 8 migration.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.