6

I'm getting this error when running this code:

$googleAdsClient->getGoogleAdsServiceClient()->search($customerId, $query, $page_size);

ERROR message: proto descriptor was previously loaded (included in multiple metadata bundles?): google/ads/googleads/v5/enums/policy_topic_evidence_destination_not_working_dns_error_type.proto

$googleAdsClient is an instance of \Google\Ads\GoogleAds\Lib\V5\GoogleAdsClient.

The getGoogleAdsServiceClient method comes from the ServiceClientFactoryTrait trait /Google/Ads/GoogleAds/Lib/V5/ServiceClientFactoryTrait.php

I'm running:

php 7.4.1
grpc module version => 1.34.0
protobuf version => 3.14.0

Additional libs installed via composer:

google/grpc-gcp                       0.1.5      gRPC GCP library for channel management
google/protobuf                       v3.13.0.1  proto library for PHP
googleads/google-ads-php              v5.0.0     Google Ads API client for PHP
grpc/grpc                             1.30.0     gRPC library for PHP

I don't know enough about descriptors or the protobuf library to understand this error. It just started happening a couple days ago and I don't think we made any changes that would effect this. Any help/guidance would be much appreciated.

EDIT: forgot to link to SDK https://github.com/googleads/google-ads-php

EDIT: updated the following libs:

google/apiclient                     v2.9.1     Client library for Google APIs
google/apiclient-services            v0.161.0   Client library for Google APIs
google/auth                          v1.15.0    Google Auth Library for PHP
google/common-protos                 1.3        Google API Common Protos for PHP
google/gax                           1.7.0      Google API Core for PHP
google/grpc-gcp                      0.1.5      gRPC GCP library for channel management
google/protobuf                      v3.15.3    proto library for PHP
googleads/google-ads-php             v7.0.0     Google Ads API client for PHP
grpc/grpc                            1.35.0     gRPC library for PHP
google/protobuf                      v3.15.3    proto library for PHP
Chris
  • 4,643
  • 6
  • 31
  • 49
  • 1
    You may want to file an issue on the GitHub repo for the SDK in order to more quickly engage with its developers: https://github.com/googleads/google-ads-php/issues. You're running an old version of `google-ads-php` (v5.0.0) currently v7.0.0 **but** beside trying to maintain currency this shouldn't be an issue. – DazWilkin Feb 24 '21 at 21:59
  • According to a developer on the googleads/google-ads-php lib this is a warning message. I guess I don't understand what the error/warning means "proto descriptor was previously loaded (included in multiple metadata bundles?)". Can anyone explain this? – Chris Feb 25 '21 at 23:46
  • 1
    `.proto` files contain protobuf definitions that are the sources used by the protobuf compiler (`protoc`) to generate language-specific (e.g. PHP) implementations. It's curious that the error message specifies a `.proto` file rather than the (in this case) PHP classes that it defines. It's possible that the `.proto` is used by several components of the Ads SDK. Protobufs are often bundled with sources and so shared Protobufs could end up being duplicated. Still, an unusual message; I've not seen anything similar. – DazWilkin Feb 26 '21 at 01:56
  • @DazWilkin concern I have is that this is an error saying that I have to many file descriptors open and I'm running out therefore throwing this error. – Chris Mar 01 '21 at 23:00
  • Perhaps include that error in your question? Everything helps. – DazWilkin Mar 02 '21 at 01:05

4 Answers4

1

I found the issue for me. I had the C implementation installed via pecl install protobuf. Sense I'm running my app in a docker container, every time I built a new image it would install the latest release of protobuf. Sense I started seeing this error around the 22nd of Feb I looked at the protobuf builds and I see a build on the 20th of Feb for version 3.15.0 which coincides with a new build I ran on the 22nd.

To fix this I downgraded to version 3.14.0 via the pecl install protobuf-3.14.0 command in my Dockerfile. This isn't a permanent fix as at some point I want to upgrade the package but I will have to wait for a version that deals with this issue.

Chris
  • 4,643
  • 6
  • 31
  • 49
1

This problem was addressed in https://github.com/googleads/google-ads-php/issues/540 and fixed in protobuf version 3.18.0 ( https://github.com/protocolbuffers/protobuf/releases/tag/v3.18.0 )

iwritecode
  • 11
  • 4
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – cursorrux Sep 16 '21 at 11:12
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 16 '21 at 12:14
0

The error is because two library is your project are providing the proto descriptor for same file policy_topic_evidence_destination_not_working_dns_error_type.proto.
Looks like this issue was fixed in version v6 for google ads library link

Just update the libarry to v6 and above (latest is v7) and it should fix the problem Latest Release

Build3r
  • 1,748
  • 16
  • 22
0

I have same error, I commented out the line

; extension=protobuf.so

in /etc/php/7.4/apache2/php.ini and in /etc/php/7.4/cli/php.ini and restart apache

sudo service apache2 restart

and error was gone, I hope this will be helpful for someone.