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

While updaing google campaigns using API i keep getting call to undefined method error for a google ads api method #1039

Open
kshitizdhakalpsq opened this issue Aug 7, 2024 · 7 comments
Assignees
Labels
bug Something isn't working triage Need triage

Comments

@kshitizdhakalpsq
Copy link

kshitizdhakalpsq commented Aug 7, 2024

  • Client library version: v22.1.0
  • Google Ads API version: V16

Your environment: Lumen

  • The PHP version: 8.19.
  • The name and version of the operating system: Linux b3a615af573e 5.10.102.1-microsoft-standard-WSL2 Initial commit for v0_1. #1 SMP`.
  • Whether the PHP Extension protobuf is used or not: 4.27.3.
  • Whether the PHP Extension grpc is used or not:1.59.1.
  • The type of transport being used (grpc or rest): grpc.

Description of the bug:
Call to undefined method Google\Protobuf\FieldDescriptor::getRealContainingOneof()

Steps to reproduce:
while using:
$campaign = new Campaign($googleParams);
$campaignOperations = [];
$campaignOperation = new CampaignOperation();
$campaignOperation->setUpdate($campaign);
$campaignOperation->setUpdateMask(FieldMasks::allSetFieldsOf($campaign));

Expected behavior:
Campaign Update with no error, This happens when i go into the google ads api library and comment the line using getRealContainingOneof method

Request/Response Logs:
Im not getting any response logs, im just stuck in the error previously mentioned and the logs appear when i comment out the method name and the intended operation is successful

Please let me know if you need any more information from my side

@kshitizdhakalpsq kshitizdhakalpsq added bug Something isn't working triage Need triage labels Aug 7, 2024
@fiboknacky
Copy link
Member

fiboknacky commented Aug 9, 2024

Could you share your whole code? And do you use C or PHP implementations?
Thanks.

@kshitizdhakalpsq
Copy link
Author

kshitizdhakalpsq commented Aug 9, 2024

Sure here is the code:

$googleParams = [
      'resource_name' => customers/XXXXX/campaigns/YYYYY,
      'status' => CampaignStatus::PAUSED,
      'target_cpa' => new TargetCpa([
        'target_cpa_micros' => 38000
      ]),
    ];

    $campaign = new Campaign($googleParams);

    $campaignOperations = [];
    $campaignOperation = new CampaignOperation();
    $campaignOperation->setUpdate($campaign);
    $campaignOperation->setUpdateMask(FieldMasks::allSetFieldsOf($campaign));
    $campaignOperations[] = $campaignOperation;

    $campaignServiceClient = $googleAdsClient->getCampaignServiceClient();
    $campaignServiceClient->mutateCampaigns(
      MutateCampaignsRequest::build(
        XXXXX,
        $campaignOperations
      )
    );

Let me know if there's anything else you need from me

@fiboknacky
Copy link
Member

Note: I removed some personal identifiers from you answer.

And do you use C or PHP implementations?

Could you please answer another question of mine?

@kshitizdhakalpsq
Copy link
Author

i use PHP implementation: "google/protobuf": "^3.25",

@kshitizdhakalpsq
Copy link
Author

And one more thing, this error only happens when i use the target_cpa value. Updating status is not an issue

@kshitizdhakalpsq
Copy link
Author

@fiboknacky any updates?

@fiboknacky
Copy link
Member

Hello @kshitizdhakalpsq,

Sorry for this late reply. I was on vacation.
I couldn't reproduce the issue you reported, but what you mentioned looks more like the ones in #978 and #891.
You mentioned that your installed protobuf version is 3.25. That version should already contains the getRealContainingOneOf method. You can double-check this in the code inside the vendor directory. That method should exist in FieldDescriptor.php.

One of the possible causes would be you've installed the C implementation as well and they're kind of confusing the system like described in this comment.
I think the best way to ensure this isn't the case is to re-check your if you've somehow installed the C-implementation version as well. This guide should help you through this.

@fiboknacky fiboknacky self-assigned this Sep 12, 2024
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

2 participants