tmarois / laravel-ads-sdk

PHP SDK for Google Ads, Bing Ads, and Facebook Ads API for Laravel
MIT License
113 stars 46 forks source link

Call Undefined method ServiceClient::__getLastRequest() #5

Closed dominikraff closed 4 years ago

dominikraff commented 4 years ago

Hello,

im always getting this Error since some time: Call to undefined method Microsoft\BingAds\Auth\ServiceClient::__getLastRequest() in /root/akoro/vendor/tmarois/laravel-ads-sdk/src/Services/BingAds/Reports.php:325

Do you have a solution for this?

timothymarois commented 4 years ago

Hey @dominikraff

Can you share some of your code and what you're pulling from the API, this way I can investigate the error a bit further? I know BingAds has changed their API version, maybe you're receiving the error since they did that, but I've been running reports and haven't come across that yet, so I'm curious what you're pulling.

dominikraff commented 4 years ago

I do run this code, i would get a FinalUrlReport: $bingAds = LaravelAds::bingAds()->with($client_customer_id); $adgroupReport = $bingAds->reports($this->fromDate, $this->toDate)->getFinalUrlReport();

Thats the whole error: `Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Microsoft\BingAds\Auth\ServiceClient::__getLastRequest() in /root/akoro/vendor/tmarois/laravel-ads-sdk/src/Services/BingAds/Reports.php:325 Stack trace:

0 /root/akoro/vendor/tmarois/laravel-ads-sdk/src/Services/BingAds/Reports.php(552): LaravelAds\Services\BingAds\Reports->buildFinalUrlReport()

1 /root/akoro/app/Jobs/Bing/BingReportDownloader.php(98): LaravelAds\Services\BingAds\Reports->getFinalUrlReport()

2 /root/akoro/app/Jobs/Bing/BingReportDownloader.php(71): App\Jobs\Bing\BingReportDownloader->downloadFinalURLReport('140135277')

3 [internal function]: App\Jobs\Bing\BingReportDownloader->handle()

4 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)

5 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()

6 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))

7 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)

8 /root/akoro/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)

9 /root/akoro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus{closure}(Object(App\Jobs\Bing\BingReportDownloader))

10 /root/akoro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(App\Jobs\Bing\BingReportDownloader))

11 /root/akoro/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))

12 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(49): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\Bing\BingReportDownloader), false)

13 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(88): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)

14 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(337): Illuminate\Queue\Jobs\Job->fire()

15 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(283): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))

16 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))

17 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker->daemon('database', 'download-worker', Object(Illuminate\Queue\WorkerOptions))

18 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'download-worker')

19 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()

20 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)

21 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()

22 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))

23 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)

24 /root/akoro/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)

25 /root/akoro/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

26 /root/akoro/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

27 /root/akoro/vendor/symfony/console/Application.php(1011): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

28 /root/akoro/vendor/symfony/console/Application.php(272): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

29 /root/akoro/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

30 /root/akoro/vendor/laravel/framework/src/Illuminate/Console/Application.php(90): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

31 /root/akoro/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(133): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

32 /root/akoro/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

33 {main}`

timothymarois commented 4 years ago

@dominikraff Thanks, I will look into this today and see if I can find a solution, at least I can catch those errors so it ends gracefully.

timothymarois commented 4 years ago

Hey @dominikraff

I released a new update 1.2.14, it cleans up the BingAds errors. I did run a test on that specific report getFinalUrlReport and it has successfully ran on my end (returning results).

BingAds has made an update to their API a few months back, make sure you run composer update to be sure. My fix should prevent you from getting the undefined error message, and hopefully, it tells you exactly why Bing is throwing an error.

dominikraff commented 4 years ago

Now i geht this error:

`ErrorException: Undefined variable: reportRequestId in /root/akoro/vendor/tmarois/laravel-ads-sdk/src/Services/BingAds/Reports.php:333 Stack trace:

0 /root/akoro/vendor/tmarois/laravel-ads-sdk/src/Services/BingAds/Reports.php(333): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined varia...', '/root/akoro/ven...', 333, Array)

1 /root/akoro/vendor/tmarois/laravel-ads-sdk/src/Services/BingAds/Reports.php(568): LaravelAds\Services\BingAds\Reports->buildFinalUrlReport()

2 /root/akoro/app/Jobs/Bing/BingReportDownloader.php(98): LaravelAds\Services\BingAds\Reports->getFinalUrlReport()

3 /root/akoro/app/Jobs/Bing/BingReportDownloader.php(71): App\Jobs\Bing\BingReportDownloader->downloadFinalURLReport('140135277')

4 [internal function]: App\Jobs\Bing\BingReportDownloader->handle()

5 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)

6 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()

7 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))

8 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)

9 /root/akoro/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)

10 /root/akoro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus{closure}(Object(App\Jobs\Bing\BingReportDownloader))

11 /root/akoro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(App\Jobs\Bing\BingReportDownloader))

12 /root/akoro/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))

13 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(49): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\Bing\BingReportDownloader), false)

14 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(88): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)

15 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(337): Illuminate\Queue\Jobs\Job->fire()

16 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(283): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))

17 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))

18 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker->daemon('database', 'download-worker', Object(Illuminate\Queue\WorkerOptions))

19 /root/akoro/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'download-worker')

20 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()

21 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)

22 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()

23 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))

24 /root/akoro/vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)

25 /root/akoro/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)

26 /root/akoro/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

27 /root/akoro/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

28 /root/akoro/vendor/symfony/console/Application.php(1011): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

29 /root/akoro/vendor/symfony/console/Application.php(272): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

30 /root/akoro/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

31 /root/akoro/vendor/laravel/framework/src/Illuminate/Console/Application.php(90): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

32 /root/akoro/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(133): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

33 /root/akoro/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

34 {main}`

timothymarois commented 4 years ago

Hey, @dominikraff I have released another quick patch for looking at these bing errors. Run composer again to update and you should now see an output of why the response is failing for you.

Improving the Bing error messages is on my list to do.

dominikraff commented 4 years ago

Thats now the output:

SoapFault exception: [s:Server] Invalid client data. Check the SOAP fault details for more information in /root/akoro/vendor/tmarois/laravel-ads-sdk/src/Services/BingAds/ReportDownload.php:161