Segmentation fault when trying to mutate create AdGroupAd for app_ad

189 views
Skip to first unread message

Ben Laor

unread,
Jan 12, 2021, 8:57:30 AM1/12/21
to AdWords API and Google Ads API Forum

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]);
    }

Google Ads API Forum Advisor Prod

unread,
Jan 12, 2021, 2:56:01 PM1/12/21
to b...@bidshake.com, adwor...@googlegroups.com
Hi Ben,

Please enable logging and provide us with the API request and response so we can have a closer look.

Thanks,
Anthony

Google Logo
Anthony
Google Ads API Team
 


ref:_00D1U1174p._5004Q2AJbQb:ref

Ben Laor

unread,
Jan 13, 2021, 8:52:31 AM1/13/21
to AdWords API and Google Ads API Forum
Ok the issue was found.
I forgot to write "return" statements on the array_map functions in the AppAdInfo building part.
The segmentation fault is a real headache it gives no information about what is wrong

Google Ads API Forum Advisor Prod

unread,
Jan 13, 2021, 11:50:38 AM1/13/21
to b...@bidshake.com, adwor...@googlegroups.com
Hi Ben,

Glad to know you were able to find the cause of your issue. Please let me know if you run into any other trouble.

Regards,

Ben Laor

unread,
Jan 13, 2021, 5:24:02 PM1/13/21
to AdWords API and Google Ads API Forum
Actually there is, i'm receiving an "This operation is not permitted on this campaign type" error when sending the request.
Is it because this is an appAd? how else am i supposed to create an appAd if not like this? my campaign is also an app campaign

request ID: W1yBUPUHiNIfXMhbnYTADA

Google Ads API Forum Advisor Prod

unread,
Jan 14, 2021, 2:00:56 AM1/14/21
to b...@bidshake.com, adwor...@googlegroups.com
Hi Ben,

I work with Anthony and allow me to assist you for now.

So that our team can investigate further, could you also provide the complete details of your request and response logs by enabling logging? You may then send the requested details using the Reply privately to author option.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2AJbQb:ref

Ben Laor

unread,
Jan 14, 2021, 3:21:49 AM1/14/21
to AdWords API and Google Ads API Forum
I need permission to reply privately

Google Ads API Forum Advisor Prod

unread,
Jan 14, 2021, 4:47:46 AM1/14/21
to b...@bidshake.com, adwor...@googlegroups.com
Hi Ben,

If the option to reply privately is not available, you can send the details to our (googleadsa...@google.com) alias instead.

Ben Laor

unread,
Jan 14, 2021, 4:59:54 AM1/14/21
to AdWords API and Google Ads API Forum
Alright, i have sent the logs to that address (it contains a different request id, as i tried again for fresh logs)

On Thursday, January 14, 2021 at 11:47:46 AM UTC+2 adsapiforumadvisor wrote:
Hi Ben,

If the option to reply privately is not available, you can send the details to our (googleadsapi-support@google.com) alias instead.

Ben Laor

unread,
Jan 14, 2021, 10:07:32 AM1/14/21
to AdWords API and Google Ads API Forum
I found the issue, i was sending status on the adGroupAd operation, which is invalid (not specified anywhere i have seen and the error was very unclear about it)

On Thursday, January 14, 2021 at 11:59:54 AM UTC+2 Ben Laor wrote:
Alright, i have sent the logs to that address (it contains a different request id, as i tried again for fresh logs)

On Thursday, January 14, 2021 at 11:47:46 AM UTC+2 adsapiforumadvisor wrote:
Hi Ben,

If the option to reply privately is not available, you can send the details to our (googleadsa...@google.com) alias instead.
Reply all
Reply to author
Forward
0 new messages