Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending Example by metrics.conversions breaks request #104

Closed
ay6ARX8t opened this issue Jun 3, 2019 · 7 comments
Closed

Extending Example by metrics.conversions breaks request #104

ay6ARX8t opened this issue Jun 3, 2019 · 7 comments
Assignees

Comments

@ay6ARX8t
Copy link

ay6ARX8t commented Jun 3, 2019

Hello,

we're running version 1.3.0 of the new ads API and I have been able to run the example query in https://github.com/googleads/google-ads-php/blob/master/examples/Reporting/GetKeywordStats.php . However, when I try to modify the query and add metrics.conversions I run into a strange error.

Unknown error (0) Error: Call to a member function jsonByteSize() on float in /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php:1687
Stack trace:
#0 /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1828): Google\Protobuf\Internal\Message->fieldDataOnlyJsonByteSize(Object(Google\Protobuf\Internal\FieldDescriptor), 0)
#1 /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1936): Google\Protobuf\Internal\Message->fieldJsonByteSize(Object(Google\Protobuf\Internal\FieldDescriptor))
#2 /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1687): Google\Protobuf\Internal\Message->jsonByteSize()
#3 /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1828): Google\Protobuf\Internal\Message->fieldDataOnlyJsonByteSize(Object(Google\Protobuf\Internal\FieldDescriptor), Object(Google\Ads\GoogleAds\V1\Common\Metrics))
#4 /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1936): Google\Protobuf\Internal\Message->fieldJsonByteSize(Object(Google\Protobuf\Internal\FieldDescriptor))
#5 /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1687): Google\Protobuf\Internal\Message->jsonByteSize()
#6 /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1818): Google\Protobuf\Internal\Message->fieldDataOnlyJsonByteSize(Object(Google\Protobuf\Internal\FieldDescriptor), Object(Google\Ads\GoogleAds\V1\Services\GoogleAdsRow))
#7 /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1936): Google\Protobuf\Internal\Message->fieldJsonByteSize(Object(Google\Protobuf\Internal\FieldDescriptor))
#8 /data/home/conrad/www/adwords.winlocal.de/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1491): Google\Protobuf\Internal\Message->jsonByteSize()
#9 /data/home/conrad/www/adwords.winlocal.de/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V1/LogMessageFormatter.php(127): Google\Protobuf\Internal\Message->serializeToJsonString()
#10 /data/home/conrad/www/adwords.winlocal.de/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V1/GoogleAdsUnaryCallLogger.php(93): Google\Ads\GoogleAds\Lib\V1\LogMessageFormatter->formatDetail(Array, Array, 'googleads.googl...')
#11 /data/home/conrad/www/adwords.winlocal.de/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V1/GoogleAdsLoggingUnaryCall.php(60): Google\Ads\GoogleAds\Lib\V1\GoogleAdsUnaryCallLogger->logDetails(Array, Array)
#12 /data/home/conrad/www/adwords.winlocal.de/vendor/google/gax/src/Transport/GrpcTransport.php(242): Google\Ads\GoogleAds\Lib\V1\GoogleAdsLoggingUnaryCall->wait()
#13 /data/home/conrad/www/adwords.winlocal.de/vendor/guzzlehttp/promises/src/Promise.php(246): Google\ApiCore\Transport\GrpcTransport->Google\ApiCore\Transport\{closure}(true)
#14 /data/home/conrad/www/adwords.winlocal.de/vendor/guzzlehttp/promises/src/Promise.php(223): GuzzleHttp\Promise\Promise->invokeWaitFn()
#15 /data/home/conrad/www/adwords.winlocal.de/vendor/guzzlehttp/promises/src/Promise.php(267): GuzzleHttp\Promise\Promise->waitIfPending()
#16 /data/home/conrad/www/adwords.winlocal.de/vendor/guzzlehttp/promises/src/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#17 /data/home/conrad/www/adwords.winlocal.de/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#18 /data/home/conrad/www/adwords.winlocal.de/vendor/google/gax/src/GapicClientTrait.php(591): GuzzleHttp\Promise\Promise->wait()
#19 /data/home/conrad/www/adwords.winlocal.de/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V1/Services/Gapic/GoogleAdsServiceGapicClient.php(268): Google\Ads\GoogleAds\V1\Services\Gapic\GoogleAdsServiceGapicClient->getPagedListResponse('Search', Array, 'Google\\Ads\\Goog...', Object(Google\Ads\GoogleAds\V1\Services\SearchGoogleAdsRequest))
#20 /data/home/conrad/www/adwords.winlocal.de/app/components/AdwordsClientComponent.php(152): Google\Ads\GoogleAds\V1\Services\Gapic\GoogleAdsServiceGapicClient->search(1680026166, 'SELECT campaign...', Array)

Final query sent is:

$query =
				"SELECT campaign.id, "
				. "campaign.name, "
				. "ad_group.id, "
				. "ad_group.name, "
				. "ad_group_criterion.criterion_id, "
				. "ad_group_criterion.keyword.text, "
				. "ad_group_criterion.keyword.match_type, "
				. "metrics.impressions, "
				. "metrics.conversions, "
				. "metrics.clicks, "
				. "metrics.cost_micros "
				. "FROM keyword_view "
				. "WHERE segments.date DURING LAST_7_DAYS "
				. "AND campaign.advertising_channel_type = 'SEARCH' "
				. "AND ad_group.status = 'ENABLED' "
				. "AND ad_group_criterion.status IN ('ENABLED', 'PAUSED') "
				// Limits to the 50 keywords with the most impressions in the date range.
				. "ORDER BY metrics.impressions DESC "
				. "LIMIT 50";

Thank you for helping.

@fiboknacky fiboknacky self-assigned this Jun 3, 2019
@fiboknacky
Copy link
Member

Hi,

Could you share all your code as well?
In particular, how did you change the result printing section of the example?

Best,
Knack

@PierrickVoulet
Copy link
Collaborator

Hello,

Few additional questions as it could be related to another issue I experienced recently:

  • At what page number does it fail?
  • Could you confirm if the gRPC PHP extension you are using is managed by PECL (C implementation) or Composer (PHP native implementation)?

Thanks,

@ay6ARX8t
Copy link
Author

ay6ARX8t commented Jun 4, 2019

Hi there,

thanks for the responses.

  • the code is basically:
// wrapper to connect to master mcc
$googleAdsServiceClient = $this->client->getGoogleAdsServiceClient();

$query =
				"SELECT campaign.id, "
				. "campaign.name, "
				. "ad_group.id, "
				. "ad_group.name, "
				. "ad_group_criterion.criterion_id, "
				. "ad_group_criterion.keyword.text, "
				. "ad_group_criterion.keyword.match_type, "
				. "metrics.impressions, "
				. "metrics.all_conversions, "
				. "metrics.clicks, "
				. "metrics.cost_micros "
				. "FROM keyword_view "
				. "WHERE segments.date DURING LAST_7_DAYS "
				. "AND campaign.advertising_channel_type = 'SEARCH' "
				. "AND ad_group.status = 'ENABLED' "
				. "AND ad_group_criterion.status IN ('ENABLED', 'PAUSED') "
				// Limits to the 50 keywords with the most impressions in the date range.
				. "ORDER BY metrics.impressions DESC "
				. "LIMIT 50";

// Issues a search request by specifying page size.
			try {
				$response =
					$googleAdsServiceClient->search($this->remoteId, $query, ['pageSize' => 1000]);
			} catch (Exception $e) {
				print_r($e->getMessage());

			}

			die();
  • It does seem to fail on the initial call, since we're not iterating the results.
  • I think it's the PECL managed one, which has an upgrade available
pear list-upgrades
pear.php.net Available Upgrades (stable):
=========================================
Channel      Package     Local           Remote          Size
pear.php.net Archive_Tar 1.4.6 (stable)  1.4.7 (stable)  21kB
pear.php.net PEAR        1.10.8 (stable) 1.10.9 (stable) 286kB
pecl.php.net Available Upgrades (stable):
=========================================
Channel      Package Local           Remote          Size
pecl.php.net gRPC    1.20.0 (stable) 1.21.3 (stable) 2644kB

@robtro
Copy link

robtro commented Jun 6, 2019

I'm also seeing this problem. Removing metrics.conversions from the query does in fact clear the error.
For the record, upgrading the pecl-managed gRPC does not solve the issue.

@PierrickVoulet
Copy link
Collaborator

I think you are experiencing the same kind of issue as in #105 but the error traces do not seem to match though.

@Raibaz
Copy link
Contributor

Raibaz commented Jul 1, 2019

This should have been fixed by V2.0.0.

@Raibaz
Copy link
Contributor

Raibaz commented Jul 4, 2019

Closing this due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants