googleads / googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP
Apache License 2.0
655 stars 770 forks source link

GuzzleHttp Errors. API Offline. #411

Closed timothymarois closed 6 years ago

timothymarois commented 6 years ago

Hello, today our API has been shut down because of the following error. We have been running this API for a few years and have updated to the latest versions when released. However we have not changed anything recently, in fact, it just started early this morning, looks like something someone released internally causing this error to reveal itself.

Uncaught ReflectionException: Method GuzzleHttp\Middleware::GuzzleHttp\{closure}() does not exist in ~/app/core/Views/errors/html/error_exception.php:91 
Stack trace: #0 ~/app/core/Views/errors/html/error_exception.php(91): ReflectionMethod->__construct('GuzzleHttp\\Midd...', 'GuzzleHttp\\{clo...') #1 ~/system/Debug/Exceptions.php(149): `

I know this is more on the GuzzleHttp package, however, nothing has been changed there, or on the GoogleAds package, the only thing I can see is the API response that is causing this.

Hopefully, someone can pinpoint a solution here, I am using v201705 I tested v201708 and same issue.

To narrow my use down, I am using ReportDownloader when trying to pull a report, I receive this error.

thangduo commented 6 years ago

Hi Timothy,

Are you using DFP or AdWords?

Thanks, Thang Duong

fiboknacky commented 6 years ago

Hello Timothy,

To help us debug this, is it possible for you to capture something before it reaches the line throwing that error?

Best, Knack

timothymarois commented 6 years ago

@thangduo We are using AdWords.

timothymarois commented 6 years ago

@fiboknacky Not really sure. It's been running for months without an issue, it ran a little today and then stopped due to this error. And I never made changes to the code or updated the packages, so I wonder if the AdWords response has changed causing it to fail. If I was reaching any limits, wouldn't it have a proper exception error thrown?

timothymarois commented 6 years ago

@fiboknacky I misunderstood what you asked, yes it's possible. What would you have in mind?

I narrowed it down to running the method downloadReport from ReportDownloader

fiboknacky commented 6 years ago

I'm not quite sure yet too, but the only part that we use Guzzle Middleware is in this file. It'll log a request and response for you. Could you please investigate around this part first?

As for the change in the response, I'm not aware of such a change. And if there is a change, I wouldn't expect an error message to be like that. To the best of my knowledge, it looks like Guzzle in your system suddenly disappears as it can't find the middleware to work with.

timothymarois commented 6 years ago

I ran a test with GuzzleHttp by itself and it's able to request and access URLs, so the package itself appears to be intact. One thing I noticed to reproduce the error, I tried to request access to a URL that does not exist, and the Uncaught exception is thrown. For the AdWords API, is there a way I can pull a log for the requested URLs it's trying to reach?

timothymarois commented 6 years ago

And the other thing, if the API rejects my URL requests due to limits? Though I feel the error would be more graceful.

timothymarois commented 6 years ago

After some further investigation. I found out the API was linked to an email that was deleted today, though the original AdWords account manager is still running (just moved) to another account email. So the system I was running did not properly parse the error message, I then tried within a clean environment and it revealed itself. Account has been deleted

Thanks anyway, I wonder if the API should have a better way to parse the error exception.