Thank you for your feedback. This error is very common but not consistently reproducible. For example, this morning it worked between 10:55 and 11:10
When the error occurs, I don't get a requestID because the gRPC log indicates "Status code: 14 Details: failed to connect to all addresses". The customer Id is 5918386111.
Here is the complete request as declared in PHP (using the PHP library):
<?php
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\Lib\V13\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Util\V13\ResourceNames;
use Google\Ads\GoogleAds\V13\Enums\KeywordPlanNetworkEnum\KeywordPlanNetwork;
use Google\Ads\GoogleAds\V13\Services\KeywordSeed;
$customerId = '5918386111';
$oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();
$googleAdsClient = (new GoogleAdsClientBuilder())
->fromFile()
->withOAuth2Credential($oAuth2Credential)
->build();
$keyword = 'avion';
$keywordPlanIdeaServiceClient = $googleAdsClient->getKeywordPlanIdeaServiceClient();
$locationIds = [ 2250 ]; // France
$geoTargetConstants = array_map(function ($locationId) {
return ResourceNames::forGeoTargetConstant($locationId);
}, $locationIds);
$requestOptionalArgs = [];
$requestOptionalArgs['keywordSeed'] = new KeywordSeed(['keywords' => [$keywords]]);
$response = $keywordPlanIdeaServiceClient->generateKeywordIdeas(
[
'language' => ResourceNames::forLanguageConstant( 1002 ), // French
'customerId' => $customerId,
'geoTargetConstants' => $geoTargetConstants,
'keywordPlanNetwork' => KeywordPlanNetwork::GOOGLE_SEARCH,
'keywordSeed' => new KeywordSeed(['keywords' => [$keyword]]),
'retrySettings' => [
'retriesEnabled' => false,
]
]
); And here is an excerpt from the gRPC error log:
[2023-04-13T09:06:24.671191+00:00] google-ads.WARNING: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v13.services.KeywordPlanIdeaService/GenerateKeywordIdeas", CustomerId: 5918386111, RequestId: "", IsFault: 1, FaultMessage: "None"
[2023-04-13T09:06:24.671326+00:00] google-ads.NOTICE: Request
-------
Method Name: /google.ads.googleads.v13.services.KeywordPlanIdeaService/GenerateKeywordIdeas
Host: googleads.googleapis.com
Headers: {
"x-goog-api-client": "gl-php\/7.4.25 gccl\/18.0.0 gapic\/18.0.0 gax\/1.12.1 grpc\/1.46.0RC2 rest\/1.12.1",
"x-goog-request-params": "customer_id=5918386111",
"developer-token": "REDACTED"
}
Request:
{"customerId":"5918386111","language":"languageConstants/1002","geoTargetConstants":["geoTargetConstants/2250"],"keywordPlanNetwork":"GOOGLE_SEARCH","keywordSeed":{"keywords":["avion"]}}
Response
-------
Headers: []
Fault
-------
Status code: 14
Details: 403:Forbidden
Failure: {}
And if I try the same request again twenty minutes later, it may or may not succeed. What could explain why gRPC is occasionally unable to contact the API server?