0

In localhost everything working fine . But in live server its breaking at a fatal error and not executing further.

    /* ======== API CONFIG ========== */
require __DIR__.'/dev_components/wallet_api_components/vendor/autoload.php';
use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;
use Coinbase\Wallet\Resource\Account;
use Coinbase\Wallet\Resource\Address;
use Coinbase\Wallet\Resource\Transaction;
use Katzgrau\KLogger\Logger;
/* Settings */
$apiKey = "XXXXXXXXXX";
$apiSecret = "YYYYYYYYYYYYYYY";
$configuration = Configuration::apiKey($apiKey, $apiSecret);
$logger = new Logger(__DIR__.'/errorlog', Psr\Log\LogLevel::WARNING, array (
    'logFormat' => '{date} - {level} - {message}',
    'filename'  => 'error_log',
    'extension' => 'txt'
));
$logger->info('INFO message');
$configuration->setLogger($logger);
$client = Client::create($configuration);
// I have used print_r($configuration) ; print_r($client) to check the full 
//configuration and client object and in both localhost and Live server its 
//showing same data


$account_btc = $client->getAccount('BTC'); // From this line nothing executing
$account_eth = $client->getAccount('ETH');

the Error is

stderr: PHP Catchable fatal error: Argument 1 passed to Coinbase\Wallet\Exception\HttpException::exceptionClass() must be an instance of Psr\Http\Message\ResponseInterface, null given, called in /path/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 33 and defined in /path/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 98

What is the reason behind getting the above fatal error in Live Server and how to get rid of this ?

2 Answers2

2

I also received this error when i setup coinbase api. This error was due to ssl certificate so i downloaded cacert.pem file from https://curl.se/docs/caextract.html and place it in etc folder. After it i have change vert name in "src/Configuration.php" at line 58 "$this->caBundle = DIR.'/../etc/ca-coinbase.crt'" to "$this->caBundle = DIR.'/../etc/cacert.pem'". Thus my error solved .

Eithan pitt
  • 841
  • 9
  • 12
0

I am assuming you have not posted entire error dump, but looking at your error: stderr: PHP Catchable fatal error: Argument 1 passed to Coinbase\Wallet\Exception\HttpException::exceptionClass() must be an instance of Psr\Http\Message\ResponseInterface

This means that when HTTPException:exceptionClass() is called, you have to call it using a ResponseInterface object in the argument.

If the above thing does not solve your problem, then post entire error dump. If you do not post entire error dump, it's difficult to know the root cause.

tech_enthusiast
  • 683
  • 3
  • 12
  • 37