OperationAccessDenied.fieldPathElements not an array, Perl AdWords API v201702

47 views
Skip to first unread message

Phillip Pegelow

unread,
Jun 14, 2017, 1:03:39 PM6/14/17
to AdWords API Forum
Relates to https://groups.google.com/forum/#!topic/adwords-api/aTOWJMBFH1M 

Parsing OperationAccessDenied error objects using the above perl library (Google::Ads::Common::ErrorUtils::get_source_operation_index() )is returning undef.  It appears that the adwords library code expects calling get_fieldPathElements() on the error object to return an array, however it returns a scalar in this case.

This issue has only arisen for this specific type of error object.  I don't know if this is a problem with the perl library or the object that the api is sending, but we are unable to use the batch job service while this is happening.  Any idea what's going on?

Thank you,
Phil

Shwetha Vastrad (AdWords API Team)

unread,
Jun 14, 2017, 4:02:09 PM6/14/17
to AdWords API Forum
Hi Phil,

Do you happen to have the SOAP request/response logs for the request which encountered the OperationAccessDenied error? Please use Reply privately to author when responding. An sample error looks like this: 

<errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="OperationAccessDenied">
   
<fieldPath>operations[0].operand.ad</fieldPath>
   
<fieldPathElements>
       
<field>operations</field>
       
<index>0</index>
   
</fieldPathElements>
   
<fieldPathElements>
       
<field>operand</field>
   
</fieldPathElements>
   
<fieldPathElements>
       
<field>ad</field>
   
</fieldPathElements>
   
<trigger>SEARCH_STANDARD</trigger>
   
<errorString>OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_AD_GROUP_TYPE</errorString>
   
<ApiError.Type>OperationAccessDenied</ApiError.Type>
   
<reason>OPERATION_NOT_PERMITTED_FOR_AD_GROUP_TYPE</reason>
</errors>

Regards,
Shwetha, AdWords API Team.

Phillip Pegelow

unread,
Jun 14, 2017, 6:37:40 PM6/14/17
to AdWords API Forum
Unfortunately we don't log the full SOAP response on failures (they are all processed through the adwords perl library so they aren't typically of use for debugging to us).  On top of that, we implemented a work-around in which we don't use the batch job service in order to not have this affect our operations so we aren't seeing this error. I can try to replicate this through our test account, but that may not be very easy to do.

Shwetha Vastrad (AdWords API Team)

unread,
Jun 14, 2017, 9:24:02 PM6/14/17
to AdWords API Forum
Hi Phillip, 

In that case, do you happen to have the BatchJobIds in which this error occurred? It'll be helpful in identifying the source of the issue. 

Thanks,
Shwetha, AdWords API Team.

Nadine Sundquist (AdWords API Team)

unread,
Jun 16, 2017, 2:41:44 PM6/16/17
to AdWords API Forum
Hi Phillip,

Thanks for all the additional information. Giving us the batch job IDs meant I could retrieve the output that was being parsed, which made it easily reproducible. It was indeed an issue in the Perl library. I've made a fix, and the fix will be in the next push of the Perl client library. In the meantime, if you would like to fix it in your own code base until that push goes out, here's the fix.

In ErrorUtils.pm replace:

($field_path_elements && (scalar $field_path_elements > 0))

with
 
 ($field_path_elements && (scalar @{$field_path_elements} > 0))

The issue was that if the field path elements for that error only had one element (which is not very common), Perl assumes it's just a string rather than an array. By forcing it always to an array, everything works properly. I gave it a try across all your errors, and it looks good to go.

Happy coding,
Nadine, AdWords API Team 
Reply all
Reply to author
Forward
0 new messages