rcc
rcc

Reputation: 5

Calling TargetingIdeaService Crashes randomly

Fellow backend-ers,

I have a curious problem with using TargetingIdeaService. I am using the normal template that is provided for php and it works. Problem is that sometimes (maybe 1/10) calls ends in crashing my script. I only receive a 500 code in the calling google script and after thoroughly logging I see that it crashes on the line

$page = $targetingService->get($selector);

So, this is with the same arguments all the time, that sometimes it only ends in a black hole. There's no exception, just silence. Has anyone experienced something like this?

The service object and the selector are defined like this:

// create and setup service
$adWordsServices = new AdWordsServices();
$targetingService = $adWordsServices->get($session, TargetingIdeaService::class);
...
$selector->setIdeaType('KEYWORD');
$selector->setRequestType('STATS');
$selector->setRequestedAttributeTypes(array('KEYWORD_TEXT', 'SEARCH_VOLUME'));

As for logs I don't have too much to show. the soap request looks normally like this:

[2018-09-26 15:32:35] AW_SOAP.INFO: clientCustomerId=574-260-3578 operations=1 service=TargetingIdeaService method=get responseTime=149 requestId=000576c6414f81880a56e5054f00160b server=adwords.google.com isFault=0 faultMessage=  

Upvotes: 0

Views: 114

Answers (1)

dorian
dorian

Reputation: 6292

The Adwords API raises server errors all the time. The ones that are relevant for the TargetingIdeaService are listed here.

The log entry you listed is a bit strange in that regard as it seems to be for a successful request—note that the isFault attribute is zero and there's no faultMessage. Normally you should be able to see what the problem is by investigating that field.

As long as it's not a persistent error such as an invalid OAuth2 access token, the recommended way of dealing with these errors is to retry the request using an exponential backoff strategy.

From personal experience, we get UNEXPECTED_INTERNAL_API_ERROR maybe once every couple of thousand operations, and in almost all cases the request succeeds once we re-submit it.

Upvotes: 0

Related Questions