Getting WordPress fatal error when hitting WooCommerce API

So, after fiddling with this all week, i finally found the solution.

In my original script, i asked for 99999 products with this line:

$products = $woocommerce->get('products', $parameters=['per_page' => 99999]); 

I also had this function in functions.php in WP:

function maximum_api_filter($query_params) {
    $query_params['per_page']["maximum"]= 99999;
    return $query_params;
}

add_filter('rest_product_collection_params', 'maximum_api_filter');

The new changes i made to the script was that i changed “per_page” to 100, and then looped through it x number of times and finally merged the arrays.

The new solution works fine, and the fatal error i was getting before was maybe caused by WordPress trying to serve me several hundreds of products at one go witch may have overloaded or triggered something on the server. Dont know this for sure, but new solution works fine.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)