Closed lezhnev74 closed 5 years ago
Hi,
Can you please provide the code that you are executing that results in this exception? Thanks
Sure, here I get an error (I think it has something to do wit han ainvalid GQL snippet):
While this snippet does NOT raise any problems:
Yes, the issue is indeed with your GAQL query: GAQL does not support SELECT *, and that is the reason why the first query is failing with INVALID_ARGUMENT.
I also agree the error message could use some improvement, I'll let the API engineers know.
It is interesting. When I enabled the logging option like this:
(new \Google\Ads\GoogleAds\Lib\V1\GoogleAdsClientBuilder())
->withDeveloperToken($this->clientDeveloperToken)
->withOAuth2Credential($this->buildOAuthCredentials($userId))
->withLogger($this->logger) // <----------
->build();
I can see that the log shows what exactly went wrong with the request. Here is a sample from the log:
[2019-06-07 13:49:30] local.NOTICE: Request
-------
Method Name: /google.ads.googleads.v1.services.GoogleAdsService/Search
Host: googleads.googleapis.com
Headers: {
"x-goog-api-client": "gl-php\/7.2.18 gapic\/ gax\/0.38.0 grpc\/1.21.3",
"x-goog-request-params": "customer_id=8530332597",
"developer-token": "REDACTED"
}
Request: {"customerId":"8530332597","query":" SELECT \n \n campaign_criterion.resource_name,\n campaign_criterion.type,\n campaign_criterion.status\n \n FROM campaign_criterion\n WHERE campaign_criterion.campaign = 'customers\/8530332597\/campaigns\/2013530618' AND status = 2 "}
Response
-------
Headers: {
"request-id": "OmmuThSFOoQugnFHeF_RFQ",
"date": "Fri, 07 Jun 2019 13:49:30 GMT",
"alt-svc": "quic=\":443\"; ma=2592000; v=\"46,44,43,39\""
}
Fault
-------
Status code: 3
Details: Request contains an invalid argument.
Failure: {"errors":[{"errorCode":{"queryError":"UNRECOGNIZED_FIELD"},"message":"Unrecognized field in the query: 'status'."}]}
The Fault
section has quite a detailed problem description.
This is very good!
@lezhnev74 ,
Can you please tell what you have defined under $this->logger.
I tried this but without any success.
$log = new Logger('TestChanel'); $stream = new StreamHandler($logPath, Logger::ERROR); $stream->setFormatter(new LineFormatter(null, null, false, true)); $log->pushHandler($stream);
Thanks
I am using a framework (Laravel) which prepares the logger for me. I just inject \Psr\Log\LoggerInterface
interface and pass it in the builder. If you build Logger up manually then you'd better read manual about how your chosen PSR-3 implementation works.
In case you did not have the chance to check it yet, there is more documentation about logging available here. HIH
Hi @PierrickVoulet ,
Yes I seen the Logging guide but do not know how I can use LoggerInterface. So I used Monolog logger like this and try to add GoogleAdsClientBuilder but seems I am not getting the detailed info.
$log = new Logger('TestChanel');
$stream = new StreamHandler('file.log', Logger::WARNING);
$stream->setFormatter(new LineFormatter(null, null, false, true));
$log->pushHandler($stream);
$googleAdsClient = (new GoogleAdsClientBuilder())
->withOAuth2Credential(XX)
->withLoginCustomerId('XXXX')
->withLogger($log)
->build();
If you can guide me little bit how I use LoggerInterface will be much helpful.
Thanks,
If you pass Logger:WARNING
as a filter level, wouldn't it just filter those finer than WARNING
level out?
If you'd like to see the detailed (fine levels) information, you'd need to specify the lower level, like NOTICE
, INFO
or DEBUG
.
Hello,
Yes I did that also and also set the Logger Level as Debug on Logging
[LOGGING] logFilePath = "/logs/logfile.log" logLevel = "DEBUG"
But I am not getting beyond this information.
[2019-07-04 09:58:40] TestChanel.NOTICE: Request ------- Method Name: /google.ads.googleads.v2.services.GoogleAdsService/Search Host: googleads.googleapis.com Headers: { "x-goog-api-client": "gl-php\/7.1.23 gapic\/ gax\/1.0.3 grpc\/1.20.0", "x-goog-request-params": "customer_id=1234", "developer-token": "REDACTED", "login-customer-id": "1234" } Request: {"customerId":"1234","query":"SELECT segments.date, metrics.average_cpc, metrics.clicks, metrics.conversions, metrics.conversions_from_interactions_rate, \n metrics.cost_micros, metrics.cost_per_conversion, metrics.ctr, metrics.impressions, metrics.search_absolute_top_impression_share, \n metrics.top_impression_percentage, metrics.view_through_conversions\n FROM\n customer\n WHERE\n segments.date >= 20190624 AND segments.date <= 20190630","pageSize":500} Response ------- Headers: { "request-id": "PM-K1Nh9hMqoKISJuvNv1Q", "date": "Thu, 04 Jul 2019 04:28:35 GMT", "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43,39\"" } Fault ------- Status code: 3 Details: Request contains an invalid argument. Failure: {}
If you get the line "Fault", it's probably all that the server returned. And chances are your issue would be different than what's posted in this issue. As it seems the Google Ads API-related issue, could you please post in the Google Ads API forum instead? Thank you
Hi @fiboknacky ,
Yes I posted there as well but till now No reply to that. The link is https://groups.google.com/d/topic/adwords-api/ZApUsckdvpc/discussion
The fault message Request contains an invalid argument is same what this issue said it does not tell what exactly went wrong.
Thanks,
Just a question: are you setting logLevel = "DEBUG" in the .ini file and then in the code creating a logger with Logger::WARNING
as the logging level?
If this is the case, be aware that the logging level you set in the code will override the logging level set in the .ini file, so this may be the reason why you don't see DEBUG log messages.
Ok @Raibaz ,
are you setting logLevel = "DEBUG" in the .ini file and then in the code creating a logger with Logger::WARNING as the logging level?
-> Yes, I was doing same. Now I have comment out [LOGGING] and set only Logger::DEBUG.
But Showing same error, and no information beyond this.
Response ------- Headers: { "request-id": "FVup0mtD2Jztr8D7HPnWFg", "date": "Thu, 04 Jul 2019 08:54:00 GMT", "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,44,43,39\"" } Fault ------- Status code: 3 Details: Request contains an invalid argument. Failure: {}
Hi @fiboknacky / @Raibaz
Can you please help here? How I can get details about error?
Thanks,
I see your error for that request ID as:
[{
error_code: "QueryError.PROHIBITED_METRIC_IN_SELECT_OR_WHERE_CLAUSE",
error_message: "Cannot select or filter on the following metrics: 'search_absolute_top_impression_share'(could not support requested resources: 'CUSTOMER'), 'top_impression_percentage'(could not support requested resources: 'CUSTOMER'), since metric is incompatible with the resource in the FROM clause or other selected segmenting resources."
}]
@chiragvels, what operating system are you on?
Additionally, please make sure that your $logPath
variable points to an existing, writeable file.
@fiboknacky , But I could not receive any details regarding this. @Raibaz I am on PHP 7.1.23 on mac OS 10.13.6 Yes $logPath is writable and I am providing above error logs from this $logPath only.
Thanks,
hello,
I can see this errors on cli when using Logger:ERROR
query_error: Cannot select or filter on the following metrics: 'top_impression_percentage'(could not support requested resources: 'CUSTOMER'), 'search_absolute_top_impression_share'(could not support requested resources: 'CUSTOMER'), since metric is incompatible with the resource in the FROM clause or other selected segmenting resources.
But the error log on logpath is gone. No idea why? Thanks
@Raibaz there is an issue with the same error code that I can't understand. I am making a new request to create a responsive ad, but google rejects it with a very bold statement: Request contains an invalid argument
. Is there a way to get more insights into what happened?
Here is a log message with request and response from google:
[2019-07-18 08:55:46] testing.WARNING: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v2.services.AdGroupAdService/MutateAdGroupAds", ClientCustomerId: 8530332597, RequestId: "8A8QxhLEKFNAhRoW5wroUw", IsFault: 1, FaultMessage: "None" {"cycleLabel":"4a60b57a-a659-415b-a34d-18dc5cc63daa"}
[2019-07-18 08:55:46] testing.NOTICE: Request
-------
Method Name: /google.ads.googleads.v2.services.AdGroupAdService/MutateAdGroupAds
Host: googleads.googleapis.com
Headers: {
"x-goog-api-client": "gl-php\/7.2.18 gapic\/ gax\/1.0.3 grpc\/1.21.3",
"x-goog-request-params": "customer_id=8530332597",
"developer-token": "REDACTED"
}
Request: {"customerId":"8530332597","operations":[{"create":{"status":"ENABLED","adGroup":"customers\/8530332597\/adGroups\/75277337406","ad":{"finalUrls":["https:\/\/example.org\/5d30340425d71"],"responsiveDisplayAd":{"marketingImages":[{"asset":"customers\/8530332597\/assets\/1720929337"},{"asset":"customers\/8530332597\/assets\/1725022992"}],"logoImages":[{"asset":"customers\/8530332597\/assets\/1725022863"}],"headlines":[{"text":"headline"}],"longHeadline":{"text":"long headline 5d30340425a0f"},"businessName":"business name 57"}}}}]}
Response
-------
Headers: {
"request-id": "8A8QxhLEKFNAhRoW5wroUw",
"date": "Thu, 18 Jul 2019 08:55:42 GMT",
"alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43,39\""
}
Fault
-------
Status code: 3
Details: Request contains an invalid argument.
Failure: {}
Had a look at our internal logs, and here is the error messages I found for your request id:
[{
error_code: "ImageError.ASPECT_RATIO_NOT_ALLOWED",
field_path: "operations[0].create.ad.responsive_display_ad.marketing_images[0].asset",
error_message: "The aspect ratio of the image is not allowed."
},{
error_code: "ImageError.ASPECT_RATIO_NOT_ALLOWED",
field_path: "operations[0].create.ad.responsive_display_ad.marketing_images[1].asset",
error_message: "The aspect ratio of the image is not allowed."
},{
error_code: "ImageError.ASPECT_RATIO_NOT_ALLOWED",
field_path: "operations[0].create.ad.responsive_display_ad.logo_images[0].asset",
error_message: "The aspect ratio of the image is not allowed."
},{
error_code: "CollectionSizeError.TOO_FEW",
field_path: "operations[0].create.ad.responsive_display_ad.descriptions.pinned_field",
error_message: "Too few."
},{
error_code: "FieldError.REQUIRED",
field_path: "operations[0].create.ad.responsive_display_ad.square_marketing_images.asset",
error_message: "The required field was not present."
}]
These should actually have been logged in your Failure
field, I'll open an internal bug to make sure they are.
Also, please don't comment on closed issues; please open new ones if you are experiencing problems, otherwise I may not get the notifications.
Thanks!
Thank you @Raibaz ! That internal log's entries are SUPER useful! I was pulling my hairs off today trying to recognize the problem.
i have the same error, can you help me
ApiException was thrown with message: '{
"message": "Request contains an invalid argument.",
"code": 3,
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "google.ads.googleads.v16.errors.googleadsfailure-bin",
"data": "
Did you specify the wrong customer ID? It should be that of client accounts, not manager accounts.
Did you specify the wrong customer ID? It should be that of client accounts, not manager accounts.
Thank you for bringing this to my attention. I apologize for any confusion. Just to clarify, I've been using the client account ID rather than the manager account ID. If there are any further adjustments needed, please let me know
Did you specify the wrong customer ID? It should be that of client accounts, not manager accounts.
I wanted to clarify that the function I created for retrieving client names is indeed working smoothly. However, I've encountered an issue with another function I recently developed, specifically for retrieving spend details. Unfortunately, it's not functioning as intended Attachment for working method
The log says otherwise. It looks like you sent a customer ID that is a manager account (33725XXXXX).
Please re-run your report that your webpage_view
report by specifying a client account.
The log says otherwise. It looks like you sent a customer ID that is a manager account (33725XXXXX). Please re-run your report that your
webpage_view
report by specifying a client account.
let me check with my manager
This is what I see in the log:
Is there a way to tell what argument is invalid? This exception lacks details.