Guzzlehttp error when I use coinbase/coinbase php library in Laravel project

455 Views Asked by At

Now I am using coinbase/coinbase php library in laravel project. I tried to get accounts using $client->getAccounts();, But this gives error like following.

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_RECOVERABLE_ERROR) Argument 1 passed to Coinbase\Wallet\Exception\HttpException::exceptionClass() must be an instance of Psr\Http\Message\ResponseInterface, null given, called in core\vendor\coinbase\coinbase\src\Exception\HttpException.php on line 33

I tried to get error response by checking exception.

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

This code is normal and it was working 1 year ago without any issue. Is there anyone for this issue? Thank you for everyone's response here.

2

There are 2 best solutions below

0
On

You are getting the error because the request is failing as cURL is unable to verify the certificate provided by the server.

You can solve the problem either way -

  • Allows curl command to work with “insecure” or “invalid” SSL certificates without https certificates. Use cURL with -k option which allows curl to make insecure connections, that is cURL does not verify the certificate.
  • Add the root CA (the CA signing the server certificate) to /etc/ssl/certs/ca-certificates.crt

Using Guzzle: Set verify to false

$client->request('GET', 'https://somewebsite.com', ['verify' => false]);

Note: It is best to install SSL certificate.

0
On

Try Uploading to Your online server and retry, it might be an issue with Your localhost.

I have experienced it sometime ago, but still fix, I will just upload to my cPanel and try it in production and it will work.