CURL (PHP) - Operation timed out regardless of successful call

Viewed 32

I'm facing quite weird issue related to CURL (triggered from PHP level) and BigCommerce API.

For weeks my calls were working without any issues, but since couple of days I'm experiencing "Operation timed out after 60001 milliseconds with 0 bytes received" error.

The weird part it that API operation on BigCommerce end is successful - it's a product creation call and product is created successfully.

In CURLOPT_VERBOSE info I can see that the call is failing right after "We are completely uploaded and fine", which is suggesting me that the issue is somewhere on my side and not on the remote platform which is handling API calls.

Here's my PHP code which is triggering CURL call:

$this->addHeader('Content-Type', $this->getContentType());
$this->addHeader('Connection', 'close');

if (!is_string($body)) {
 $body = json_encode($body);
}

$this->initializeRequest();

curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($this->curl, CURLOPT_URL, $url);
curl_setopt($this->curl, CURLOPT_POST, true);
curl_setopt($this->curl, CURLOPT_PUT, false);
curl_setopt($this->curl, CURLOPT_HTTPGET, false);
curl_setopt($this->curl, CURLOPT_POSTFIELDS, $body);
curl_exec($this->curl);

return $this->handleResponse();

Here is the CURLOPT_VERBOSE dump:

* Hostname api.bigcommerce.com was found in DNS cache
*   Trying 34.96.84.189...
* TCP_NODELAY set
* Connected to api.bigcommerce.com (34.96.84.189) port 443 (#0)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=US; ST=Texas; L=Austin; O=BigCommerce, Inc.; CN=*.bigcommerce.com
*  start date: Mar 16 00:00:00 2022 GMT
*  expire date: Mar  7 23:59:59 2023 GMT
*  subjectAltName: host "api.bigcommerce.com" matched cert's "*.bigcommerce.com"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert TLS RSA SHA256 2020 CA1
*  SSL certificate verify ok.
> POST /stores/[sensitive-data-trimmed-out]/v3/catalog/products HTTP/1.1
Host: api.bigcommerce.com
Accept-Encoding: deflate, gzip, br
X-Auth-Client: [sensitive-data-trimmed-out]
X-Auth-Token: [sensitive-data-trimmed-out]
Content-Type: application/json
Connection: close
Accept: application/json
Content-Length: 4009
Expect: 100-continue

< HTTP/1.1 100 Continue
* We are completely uploaded and fine
* Operation timed out after 60001 milliseconds with 0 bytes received
* Closing connection 0
[2022-09-08 05:29:33] [ERROR] Message: M\BcBundle\VendorExtends\Bigcommerce\Api\NetworkError: Operation timed out after 60001 milliseconds with 0 bytes received (uncaught exception) at Connection.php line 280 while running console command `m:bc:export:process`
File: ConsoleExceptionListener.php 
Line: 37 
Class: M\PaymentsBundle\EventListener\ConsoleExceptionListener 
Function: onConsoleException[2022-09-08 05:29:33] [ERROR] Message: Error thrown while running command "m:bc:export:process 163 1301 1950". Message: "Operation timed out after 60001 milliseconds with 0 bytes received"
File: ErrorListener.php 
Line: 48 
Class: Symfony\Component\Console\EventListener\ErrorListener 
Function: onConsoleError
In Connection.php line 280:

Operation timed out after 60001 milliseconds with 0 bytes received

Any hints are more than welcome.

0 Answers
Related