While updaing google campaigns using API i keep getting call to undefined method error for a google ads api method
kshitizdhakalpsq opened this issue · 7 comments
- 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 #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
orrest
): 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
Could you share your whole code? And do you use C or PHP implementations?
Thanks.
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
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?
i use PHP implementation: "google/protobuf": "^3.25",
And one more thing, this error only happens when i use the target_cpa value. Updating status is not an issue
@fiboknacky any updates?
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.