Client library: v5.0.0
Google Ads API: v5.0

running in docker

PHP 7.4.12 (cli) (built: Nov 5 2020 20:24:10) ( NTS )
Zend Engine v3.4.0,
ionCube PHP Loader + ionCube24 v10.4.4
Zend OPcache v7.4.12
protobuff 3.14.0
grpc 1.33.1

I'm trying to create an AdGroupAd using an existing groupAd, and i'm 
getting a "segmentation fault" error message
I've been at this for more than a day now, but the lack of details on the 
error just makes this insane to understand whats wrong

my code. Assume createAdGroupAd() is called with a valid resource name for 
an adGroup in the $adGroup parameter
and the type is CreativeType_Asset::TYPE_YOUTUBE in this case (although i 
tried with both types and both give out the error)
public function createAdGroupAd($adGroup, $data) {
        $service = $this->client->getAdGroupAdServiceClient();

        $ad = $this->createAd($data, $data['asset']->type);

        $adGroupAd = new AdGroupAd([
            'ad' => $ad,
            'status' => AdGroupAdStatus::PAUSED,
            'ad_group' =>  $adGroup 
        ]);

        $adGroupAdOperation = new AdGroupAdOperation();
        $adGroupAdOperation->setCreate($adGroupAd);

        //this is the call causing the error
        $response = $service->mutateAdGroupAds(
            $this->customerId,
            [$adGroupAdOperation]
        );

        return $response->getResults()->count() > 0 ? $response->getResults
()[0]->getResourceName() : null;
    }

    public function createAd($data, $adType = null) {
        $service = $this->client->getAdServiceClient();
        $appAdInfo = new AppAdInfo([
            'headlines' => array_map(function ($headline) {
                new AdTextAsset(['text' => $headline]);
            }, [$data['creative']->title1, $data['creative']->title2]),
            'descriptions' => array_map(function ($description) {
                new AdTextAsset(['text' => $description]);
            }, [$data['creative']->description1, $data['creative'
]->description2])
        ]);

        switch ($adType) {
            case CreativeType_Asset::TYPE_IMAGE:
                $appAdInfo->setImages([new AdImageAsset(['asset' => $data[
'assetResourceName']])]);
                break;
            case CreativeType_Asset::TYPE_YOUTUBE:
                $appAdInfo->setYoutubeVideos([new AdVideoAsset(['asset' => $
data['assetResourceName']])]);
                break;
            default:
                break;
        }

        return new Ad([
            'app_ad' => $appAdInfo,
            'type' => AdType::APP_AD]);
    }

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/cbfe1a06-1044-4a1e-9332-d99122875659n%40googlegroups.com.

Reply via email to