Woocommerce API timeout

What issue or error are you experiencing?

When trying to access an endpoint using the Woocommerce API library the operation times out:

Uncaught Automattic\WooCommerce\HttpClient\HttpClientException: cURL Error: Operation timed out after 30004

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

Install the PHP library using composer:
composer require automattic/woocommerce

Connect using the following code and try to access and endpoint

$woocommerce = new Client(
get_home_url(),
‘xxxxx’,
‘xxxxx’,
[
‘wp_api’ => true,
‘version’ => ‘wc/v3’,
‘timeout’=> 15,
‘verify_ssl’=> false,
‘query_string_auth’ => true,
]
);

   $woocommerce->get('customers');

System Details

  • Local Version:

Version 8.0.1+6490

  • Operating System (OS) and OS version:

Mac Monterrey 12.6.3


Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)

{“level”:“warn”,“linuxEdition”:null,“localVersion”:“8.0.1+6490”,“message”:“Electron Event ready”,“osArch”:“arm64”,“osPlatform”:“darwin”,“osRelease”:“21.6.0”,“timestamp”:“2023-10-30T01:12:06.556Z”,“windowsEdition”:null}
{“class”:“Process”,“level”:“warn”,“message”:“2023-10-30T01:12:31.933351Z 0 [System] [MY-010116] [Server] %%userDataPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysqld (mysqld 8.0.16) starting as process 52688”,“process”:“mysql”,“thread”:“main”,“timestamp”:“2023-10-30T01:12:32.199Z”}
{“class”:“Process”,“level”:“warn”,“message”:“2023-10-30T01:12:31.934458Z 0 [Warning] [MY-013243] [Server] --character-set-server: The character set UTF8MB3 is deprecated and will be removed in a future release. Please consider using UTF8MB4 instead.”,“process”:“mysql”,“thread”:“main”,“timestamp”:“2023-10-30T01:12:32.199Z”}
{“class”:“Process”,“level”:“warn”,“message”:“2023-10-30T01:12:31.939582Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for %%site.runData%%/mysql/data/ is case insensitive”,“process”:“mysql”,“thread”:“main”,“timestamp”:“2023-10-30T01:12:32.199Z”}
{“class”:“Process”,“level”:“warn”,“message”:“2023-10-30T01:12:32.188582Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.”,“process”:“mysql”,“thread”:“main”,“timestamp”:“2023-10-30T01:12:32.200Z”}
{“class”:“Process”,“level”:“warn”,“message”:“2023-10-30T01:12:32.199236Z 0 [System] [MY-010931] [Server] %%userDataPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysqld: ready for connections. Version: ‘8.0.16’ socket: ‘%%site.runData%%/mysql/mysqld.sock’ port: 10161 MySQL Community Server - GPL.”,“process”:“mysql”,“thread”:“main”,“timestamp”:“2023-10-30T01:12:32.200Z”}


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

hi @garethredwire

Are you using NGINX or Apache server type?

Hi, I tried both, but currently Apache.

I found a thread here with others getting the same errors. There are a handful of workarounds or troubleshooting steps within you might find useful to try here:

Thanks, I’d already found that thread before, but still times out. There’s also another similar thread on this forum but the solution was never posted.

I’ve given up on the API now and I’m calling functions directly now. Thanks tho.

1 Like

Thank you for the follow-up here @garethredwire. Sorry for not having a more concrete solution. I did a lot of searching around the web and it seems like a persistent issue that nobody has been able to really find a firm fix for.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.