We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I am using "kriswallsmith/Buzz" package with Amazon SP API SDK. I am getting the following error:
Note: See #2 in log. This line generates the error. This is 5th line in my function financialEvents(Request $request) in code given below the log.
Buzz\Exception\RequestException: SSL certificate problem: unable to get local issuer certificate in file \\amazon-spapi\vendor\kriswallsmith\buzz\lib\Client\AbstractCurl.php on line 228 #0 \\amazon-spapi\vendor\kriswallsmith\buzz\lib\Client\Curl.php(24): Buzz\Client\AbstractCurl->parseError(Object(Nyholm\Psr7\Request), 60, Resource id #45) #1 \\amazon-spapi\vendor\amazon-php\sp-api-sdk\src\AmazonPHP\SellingPartner\OAuth.php(69): Buzz\Client\Curl->sendRequest(Object(Nyholm\Psr7\Request)) #2 \\amazon-spapi\app\Http\Controllers\API\DataController.php(68): AmazonPHP\SellingPartner\OAuth->exchangeRefreshToken('Atzr|IwEBIIiZuC...') #3 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): App\Http\Controllers\API\DataController->financialEvents(Object(Illuminate\Http\Request)) #4 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('financialEvents', Array) #5 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Route.php(262): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\API\DataController), 'financialEvents') #6 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Route.php(205): Illuminate\Routing\Route->runController() #7 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Router.php(695): Illuminate\Routing\Route->run() #8 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #9 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #10 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure)) #11 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Middleware\ThrottleRequests.php(127): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #12 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Middleware\ThrottleRequests.php(103): Illuminate\Routing\Middleware\ThrottleRequests->handleRequest(Object(Illuminate\Http\Request), Object(Closure), Array) #13 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Middleware\ThrottleRequests.php(55): Illuminate\Routing\Middleware\ThrottleRequests->handleRequestUsingNamedLimiter(Object(Illuminate\Http\Request), Object(Closure), 'api', Object(Closure)) #14 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Routing\Middleware\ThrottleRequests->handle(Object(Illuminate\Http\Request), Object(Closure), 'api') #15 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Auth\Middleware\Authenticate.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #16 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure), 'sanctum') #17 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #18 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Router.php(697): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #19 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Router.php(672): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request)) #20 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Router.php(636): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route)) #21 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Routing\Router.php(625): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) #22 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(167): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) #23 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request)) #24 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #25 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #26 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure)) #27 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #28 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #29 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TrimStrings->handle(Object(Illuminate\Http\Request), Object(Closure)) #30 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #31 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure)) #32 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #33 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure)) #34 \\amazon-spapi\vendor\fruitcake\laravel-cors\src\HandleCors.php(52): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #35 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure)) #36 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Http\Middleware\TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #37 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Http\Middleware\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure)) #38 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #39 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(142): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #40 \\amazon-spapi\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request)) #41 \\amazon-spapi\public\index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #42 {main}
My code is as follows:
<?php namespace App\Http\Controllers\API; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Symfony\Component\HttpFoundation\Response; use App\Http\Controllers\API\BaseController as BaseController; use Validator; //use App\Models\User; use App\Models\SpApiAdHocData; use AmazonPHP\SellingPartner\Marketplace; use AmazonPHP\SellingPartner\Regions; use AmazonPHP\SellingPartner\SellingPartnerSDK; use Buzz\Client\Curl; use AmazonPHP\SellingPartner\Exception\ApiException; use AmazonPHP\SellingPartner\Configuration; use App\Http\Controllers\AmazonAuthController; use Monolog\Handler\StreamHandler; use Monolog\Logger; use Nyholm\Psr7\Factory\Psr17Factory; //require_once __DIR__ . '/vendor/autoload.php'; class DataController extends BaseController { private $factory; private $client; private $configuration; private $logger; private $sdk; /** * DataController constructor. */ public function __construct() { $this->factory = new Psr17Factory(); $this->client = new Curl($this->factory); $this->configuration = Configuration::forIAMUser( AmazonAuthController::CLIENT_ID, AmazonAuthController::CLIENT_SECRET, AmazonAuthController::AWS_ACCESS_KEY, AmazonAuthController::AWS_SECRET_KEY ); $this->logger = new Logger('name'); $this->logger->pushHandler(new StreamHandler(__DIR__ . '/sp-api-php.log', Logger::DEBUG)); $this->sdk = SellingPartnerSDK::create( $this->client, $this->factory, $this->factory, $this->configuration, $this->logger ); } public function financialEvents(Request $request) { $authUser = Auth::user(); //return $this->sendResponse([ 'email' => $authUser->email], 'You are OK!', Response::HTTP_OK); $row = SpApiAdHocData::where('email', $authUser->email)->get()->first(); $refreshToken = $row['refresh_token']; $accessToken = $this->sdk->oAuth()->exchangeRefreshToken($refreshToken); try { $item = $this->sdk->finances()->listFinancialEvents( $accessToken, Regions::EUROPE, 100, new \DateTimeImmutable('2022-01-01T00:00:00.00+0530'), new \DateTimeImmutable('2022-03-01T00:00:00.00+0530') ); dump($item); } catch (ApiException $exception) { dump($exception->getMessage()); } return $this->sendResponse([ 'row' => $row], 'You are OK!', Response::HTTP_OK); } }
Kindly guide.
Thank you.
Rupesh
The text was updated successfully, but these errors were encountered:
For time being, I resolved this issue by
$this->client = new Curl($this->factory, ['verify' => false]);
But I would like to implement a more permanent solution.
Kindly advise.
Sorry, something went wrong.
No branches or pull requests
Hello,
I am using "kriswallsmith/Buzz" package with Amazon SP API SDK. I am getting the following error:
Note: See #2 in log. This line generates the error. This is 5th line in my function financialEvents(Request $request) in code given below the log.
My code is as follows:
Kindly guide.
Thank you.
Rupesh
The text was updated successfully, but these errors were encountered: