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

v17.0.0 update of the FieldMasks utility causes undefined method error #844

Closed
geropeter opened this issue Aug 31, 2022 · 13 comments
Closed
Assignees
Labels
bug Something isn't working triage Need triage

Comments

@geropeter
Copy link

Your client library and Google Ads API versions:

  • Client library version: v17.0.0

  • Google Ads API version: V11

Your environment:

  • The PHP version: 7.4.18
  • The name and version of the operating system: Ubuntu 4.4.0-210-generic
  • Whether the PHP Extension protobuf is used or not: 3.19.4
  • Whether the PHP Extension grpc is used or not: 1.26.0
  • The type of transport being used (grpc or rest): grpc

Description of the bug:

By updating headline or description assets of RSAs using a batch job an error was shown pointing towards the FieldMasks utility:

Call to undefined method Google\Protobuf\FieldDescriptor::getRealContainingOneof() in /vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Util/FieldMasks.phpat line 259

Steps to reproduce:

Update a line in the headline or description asset of an RSA, the error always started when FieldMasks utility was called:

$adOperation->setUpdateMask(FieldMasks::allSetFieldsOf($ad));

Expected behavior:

Request/Response Logs:

Anything else we should know about your project / environment:

@geropeter geropeter added bug Something isn't working triage Need triage labels Aug 31, 2022
@fiboknacky
Copy link
Member

Could you update your protobuf's version to 3.21.5 first? Thanks.

@fiboknacky fiboknacky self-assigned this Sep 1, 2022
@leongersen
Copy link

I ran into this too when upgrading, upgrading the protobuf extension is the fix here.

Maybe the SDK can check the minimum required version of the extension? "google/protobuf": "^3.21.5" is required in composer.json, but there is no validation that a compatible version of the extension is installed.

https://github.com/protocolbuffers/protobuf/releases/tag/v21.5

@fiboknacky
Copy link
Member

Thanks @leongersen.
We have an open feature request here: #406.

@geropeter
Copy link
Author

I have updated protobuf's version to 3.21.5 and grpc to 1.42.0, the error unfortunately still persists. Confirmed on a single RSA with only one headline being updated ( number and content of the other headlines and descriptions and the contents of path1/2 and final url fields would not change )

@fiboknacky
Copy link
Member

Do you use the C implementation or PHP implementation?
That version should already contain the method getRealContainingOneof. I just confirmed that it worked for both C and PHP implementations.

@geropeter
Copy link
Author

I use the PHP implementation, and found the function there too. If I revert back to V16.0.0 of the Google Ads API, the update runs, there are no errors.

@fiboknacky
Copy link
Member

That's really strange. If the function is there, it shouldn't throw an error like that.
I just confirmed using the PHP implementation but didn't find any errors.
What does it look like in your composer.lock? Could you try removing it and the protobuf directory in vendor and reinstall it again?

@geropeter
Copy link
Author

Thanks @fiboknacky, I've done as you suggested, and it is working again.

@geropeter
Copy link
Author

@fiboknacky I've closed the issue too soon, I've experienced the same error after upgrading then reinstalling protobuf with composer. If I revert back to V16.0.0 of the Google Ads API, the batch job runs without errors.

@geropeter geropeter reopened this Sep 6, 2022
@fiboknacky
Copy link
Member

So, you can see that function in the protobuf code under vendor, right?
Could you share your code that triggers that error here too please?

@sksoft22
Copy link

sksoft22 commented Sep 14, 2022

How to add extension like "extension=grpc" for protobuf.so, just putting the DLL file?

*As of now I am getting below error:
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires PHP extension ext-protobuf * but it is missing from your system. Install or enable PHP's protobuf extension.

To enable extensions, verify that they are enabled in your .ini files:
- D:\xampp\php\php.ini
You can also run php --ini in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with --ignore-platform-req=ext-protobuf to temporarily ignore these required extensions.

@fiboknacky
Copy link
Member

@sksoft22 Can you follow this wiki?

@geropeter
Copy link
Author

@fiboknacky The protobuf php module was enabled, this was the source of the conflict. After disabling it everything is working again as expected.
If someone encounters the same issue, I got the idea from this ticket / article: aliyun/aliyun-tablestore-php-sdk#9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Need triage
Projects
None yet
Development

No branches or pull requests

4 participants