Coinbase API on Laravel generates the following error log. Somebody help me to solve this.This error only occurs in the live environment, but within xampp its working well. Immediate below is the error log. What could be the issue?
production.ERROR: Type error: Argument 1 passed to `Coinbase\Wallet\Exception\HttpException::exceptionClass() must be an instance of Psr\Http\Message\ResponseInterface, null given, called in /home/amunuxwq/public_html/core/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 33 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Type error: Argument 1 passed to Coinbase\\Wallet\\Exception\\HttpException::exceptionClass() must be an instance of Psr\\Http\\Message\\ResponseInterface, null given, called in /home/amunuxwq/public_html/core/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 33 at /home/amunuxwq/public_html/core/vendor/coinbase/coinbase/src/Exception/HttpException.php:98)`
This is the code am using on the laravel project.
<?php
namespace App;
use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;
use Coinbase\Wallet\Resource\Account;
use Coinbase\Wallet\Resource\Address;
class PayData {
private static $apiKey= "XXXXXXXXXXXX";
private static $apiSecret= "YYYYYYYYYYYYYYYYYYYYY";
public static function apiauth()
{
$configuration = Configuration::apiKey(self::$apiKey, self::$apiSecret);
$client = Client::create($configuration);
return $client;
}
public static function rates(){
try{
$xrate['usvalue']= PayData::apiauth()->getSpotPrice('BTC-USD')->getAmount();
$xrate['buyvalue']=PayData::apiauth()->getBuyPrice('BTC-USD')->getAmount();
$xrate['sellvalue']=PayData::apiauth()->getSellPrice('BTC-USD')->getAmount();
return $xrate;
}
catch (Exception $e){
$msg =$e->getMessage();
return $msg;
}
}
Public static function myaddress($name){
try{
$account =PayData::apiauth()->getPrimaryAccount();
$address= new Address ([
'name'=>$name
]);
$add = PayData::apiauth()->createAccountAddress($account,$address);
//$addressId=PayData::apiauth()->getAccountAddresses($account);
//$addressd = $addressId->getfirstID();
//$address = PayData::apiauth()->getAccountAddress($account,$addressd);
//echo $address->getAddress();
return $add->getAddress();
}
catch (Exception $e){
report ($e);
return false;
}
}
}