google-ads-php: Device Bid Modifier for Adgroup gives Segmentation Fault

Hi,

Device Bid Update for Adgroup is giving Segmentation Fault: 11 using AdgroupBidModifierService.

I am using code like this

try {
            // Creates an ad group bid modifier for mobile devices with the specified ad group ID and
            // bid modifier value.
            $bidModifierValue = 1.5;
            $adGroupBidModifier = new AdGroupBidModifier([
                'ad_group' => new StringValue(
                    ['value' => ResourceNames::forAdGroupBidModifier($customerId, $adGroupId)]
                ),
                'bid_modifier' => new DoubleValue(['value' => $bidModifierValue]),
                'device' => new DeviceInfo(['type' => Device::MOBILE])
            ]);

            
            $adGroupBidModifierOperation = new AdGroupBidModifierOperation();
            $adGroupBidModifierOperation->setUpdate($adGroupBidModifier);
            $adGroupBidModifierOperation->setUpdateMask(FieldMasks::allSetFieldsOf($adGroupBidModifier));

            // Issues a mutate request to add the ad group bid modifier.
            $adGroupBidModifierServiceClient = $googleAdsClient->getAdGroupBidModifierServiceClient();
            $response = $adGroupBidModifierServiceClient->mutateAdGroupBidModifiers(
                $customerId,
                [$adGroupBidModifierOperation]
            );

            $updatedAdGroupBidModifier = $response->getResults()[0];

            print $updatedAdGroupBidModifier->getResourceName() . PHP_EOL;
            
        } catch (GoogleAdsException $googleAdsException) {
            printf(
                    "Request with ID '%s' has failed.%sGoogle Ads failure details:%s",
                    $googleAdsException->getRequestId(),
                    PHP_EOL,
                    PHP_EOL
            );
            foreach ($googleAdsException->getGoogleAdsFailure()->getErrors() as $error) {
                /** @var GoogleAdsError $error */
                printf(
                        "\t%s: %s%s",
                        $error->getErrorCode()->getErrorCode(),
                        $error->getMessage(),
                        PHP_EOL
                );
            }
        } catch (ApiException $apiException) {
            printf(
                    "ApiException was thrown with message '%s'.%s",
                    $apiException->getMessage(),
                    PHP_EOL
            );
        }

What can be used or what I was doing wrong here?

I cannot get the log as well to check what was wrong.

Thanks,

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 33 (1 by maintainers)

Most upvoted comments

This lib is not working when using gRPC version 1.20.0

Can you please confirm already installed gRPC is not worked?

Thanks,