Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response includes output-only fields - Google Ads API v14 #489

Open
epark-godaddy opened this issue Apr 15, 2024 · 6 comments
Open

Response includes output-only fields - Google Ads API v14 #489

epark-godaddy opened this issue Apr 15, 2024 · 6 comments
Labels
bug Something isn't working triage New issues that need to be sorted into other labels

Comments

@epark-godaddy
Copy link

epark-godaddy commented Apr 15, 2024

Describe the bug:
https://github.com/googleads/google-ads-ruby/blob/main/examples/advanced_operations/add_smart_campaign.rb was used as reference in our implementation, but we've been unable to successfully create a smart campaign. More specifically, we heard from the Google Ads API team that we are passing output-only fields in the request body (primary_status_reasons: [], serving_status::UNSPECIFIED, bidding_strategy_system_status::UNSPECIFIED). While you can see these fields in the response, these fields are not included in our implementation and we are curious if this is a bug specific to the version of the Ads API we are currently using.

Steps to Reproduce:
Create smart campaign

Expected behavior:
Successful creation of a smart campaign

Client library version and API version:
Client library version:
Google Ads API version: 14

Request/Response Logs:


[6] sb-pry [sellbrite:production] [tenant: 637174] [09 Apr 22:28] (main)> api.create_smart_campaign(campaign, channel.google_merchant_center_id) W, [2024-04-09T22:29:09.687486 #121290] WARN -- : CID: 4897329142, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v14.services.GoogleAdsService/Mutate, IsFault: yes, Request ID:HV47H4A1DkJpLg8uLbjy-A I, [2024-04-09T22:29:09.690741 #121290] INFO -- : Outgoing request: Headers: {"developer-token":"REDACTED","login-customer-id":"5910183174","x-goog-api-client":"gl-ruby/2.7.8 gccl/23.1.0 gax/0.21.1 gapic/23.1.0 grpc/1.61.0 pb/3.25.2","x-goog-request-params":"customer_id=4897329142"} 

Payload: <Google::ads::GoogleAds::V14::Services::MutateGoogleAdsRequest: customer_id: "4897329142", mutate_operations: [<Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_budget_operation: <Google::ads::GoogleAds::V14::Services::CampaignBudgetOperation: create: <Google::ads::GoogleAds::V14::Resources::CampaignBudget: resource_name: "customers/4897329142/campaignBudgets/-1", name: "Test SSC", amount_micros: 15000000, status: :UNSPECIFIED, delivery_method: :UNSPECIFIED, period: :UNSPECIFIED, type: :SMART_CAMPAIGN, aligned_bidding_strategy_id: 0>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_operation: <Google::ads::GoogleAds::V14::Services::CampaignOperation: create: <Google::ads::GoogleAds::V14::Resources::Campaign: resource_name: "customers/4897329142/campaigns/-2", name: "Test SSC", primary_status: :UNSPECIFIED, primary_status_reasons: [], status: :ENABLED, serving_status: :UNSPECIFIED, bidding_strategy_system_status: :UNSPECIFIED, ad_serving_optimization_status: :UNSPECIFIED, advertising_channel_type: :SMART, advertising_channel_sub_type: :SMART_CAMPAIGN, url_custom_parameters: [], labels: [], experiment_type: :UNSPECIFIED, campaign_budget: "customers/4897329142/campaignBudgets/-1", bidding_strategy_type: :UNSPECIFIED, accessible_bidding_strategy: "", frequency_caps: [], video_brand_safety_suitability: :UNSPECIFIED, payment_mode: :UNSPECIFIED, excluded_parent_asset_field_types: [], excluded_parent_asset_set_types: []>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: smart_campaign_setting_operation: <Google::ads::GoogleAds::V14::Services::SmartCampaignSettingOperation: update: <Google::ads::GoogleAds::V14::Resources::SmartCampaignSetting: resource_name: "customers/4897329142/smartCampaignSettings/-2", campaign: "", phone_number: <Google::ads::GoogleAds::V14::Resources::SmartCampaignSetting::PhoneNumber: phone_number: "(602) 815-2760", country_code: "US">, advertising_language_code: "en", final_url: "https://a23349.p3187.c1.store.godaddywp.com/", business_name: "blank">, update_mask: <Google::Protobuf::FieldMask: paths: ["phone_number.phone_number", "phone_number.country_code", "advertising_language_code", "final_url", "business_name"]>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_criterion_operation: <Google::ads::GoogleAds::V14::Services::CampaignCriterionOperation: create: <Google::ads::GoogleAds::V14::Resources::CampaignCriterion: resource_name: "", campaign: "customers/4897329142/campaigns/-2", display_name: "", type: :UNSPECIFIED, status: :UNSPECIFIED>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: ad_group_operation: <Google::ads::GoogleAds::V14::Services::AdGroupOperation: create: <Google::ads::GoogleAds::V14::Resources::AdGroup: resource_name: "customers/4897329142/adGroups/-3", name: "Test SSC ad group #1712701749184", status: :UNSPECIFIED, type: :SMART_CAMPAIGN_ADS, ad_rotation_mode: :UNSPECIFIED, url_custom_parameters: [], campaign: "customers/4897329142/campaigns/-2", optimized_targeting_enabled: false, display_custom_bid_dimension: :UNSPECIFIED, effective_target_cpa_source: :UNSPECIFIED, effective_target_roas_source: :UNSPECIFIED, labels: [], excluded_parent_asset_field_types: [], excluded_parent_asset_set_types: []>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: ad_group_ad_operation: <Google::ads::GoogleAds::V14::Services::AdGroupAdOperation: create: <Google::ads::GoogleAds::V14::Resources::AdGroupAd: resource_name: "", status: :UNSPECIFIED, ad_group: "customers/4897329142/adGroups/-3", ad: <Google::ads::GoogleAds::V14::Resources::ad: resource_name: "", final_urls: [], final_app_urls: [], final_mobile_urls: [], url_custom_parameters: [], type: :SMART_CAMPAIGN_AD, device_preference: :UNSPECIFIED, url_collections: [], system_managed_resource_source: :UNSPECIFIED>, ad_strength: :UNSPECIFIED,action_items: [], labels: []>>>], partial_failure: false, validate_only: false, response_content_type: :UNSPECIFIED> I, [2024-04-09T22:29:09.690928 #121290] 

INFO -- : Incoming response (errors): Google::ads::GoogleAds::errors::GoogleAdsError(Google::ads::GoogleAds::errors::GoogleAdsError): The required field was not present.The field attempted to be mutated is immutable. called from: /home/sellbrite/app/lib/requests/google_ads_request_smart_campaign.rb:35:in `create_smart_campaign' Google::ads::GoogleAds::errors::GoogleAdsError: Google::ads::GoogleAds::errors::GoogleAdsError from /home/sellbrite/app/vendor/bundle/ruby/2.7.0/gems/google-ads-googleads-23.1.0/lib/google/ads/google_ads/interceptors/error_interceptor.rb:67:in `rescue in request_response' Caused by GRPC::InvalidArgument: 3:Request contains an invalid argument.. debug_error_string:{UNKNOWN:Error received from peer ipv4:142.251.163.95:443 {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2024-04-09T22:29:09.686892344+00:00"}} from /home/sellbrite/app/vendor/bundle/ruby/2.7.0/gems/grpc-1.61.0-aarch64-linux/src/ruby/lib/grpc/generic/active_call.rb:29:in `check_status'[6] sb-pry [sellbrite:production] [tenant: 637174] [09 Apr 22:28] (main)> api.create_smart_campaign(campaign, channel.google_merchant_center_id) W, [2024-04-09T22:29:09.687486 #121290] WARN -- : CID: 4897329142, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v14.services.GoogleAdsService/Mutate, IsFault: yes, Request ID:HV47H4A1DkJpLg8uLbjy-A I, [2024-04-09T22:29:09.690741 #121290] INFO -- : Outgoing request: Headers: {"developer-token":"REDACTED","login-customer-id":"5910183174","x-goog-api-client":"gl-ruby/2.7.8 gccl/23.1.0 gax/0.21.1 gapic/23.1.0 grpc/1.61.0 pb/3.25.2","x-goog-request-params":"customer_id=4897329142"} Payload: <Google::ads::GoogleAds::V14::Services::MutateGoogleAdsRequest: customer_id: "4897329142", mutate_operations: [<Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_budget_operation: <Google::ads::GoogleAds::V14::Services::CampaignBudgetOperation: create: <Google::ads::GoogleAds::V14::Resources::CampaignBudget: resource_name: "customers/4897329142/campaignBudgets/-1", name: "Test SSC", amount_micros: 15000000, status: :UNSPECIFIED, delivery_method: :UNSPECIFIED, period: :UNSPECIFIED, type: :SMART_CAMPAIGN, aligned_bidding_strategy_id: 0>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_operation: <Google::ads::GoogleAds::V14::Services::CampaignOperation: create: <Google::ads::GoogleAds::V14::Resources::Campaign: resource_name: "customers/4897329142/campaigns/-2", name: "Test SSC", primary_status: :UNSPECIFIED, primary_status_reasons: [], status: :ENABLED, serving_status: :UNSPECIFIED, bidding_strategy_system_status: :UNSPECIFIED, ad_serving_optimization_status: :UNSPECIFIED, advertising_channel_type: :SMART, advertising_channel_sub_type: :SMART_CAMPAIGN, url_custom_parameters: [], labels: [], experiment_type: :UNSPECIFIED, campaign_budget: "customers/4897329142/campaignBudgets/-1", bidding_strategy_type: :UNSPECIFIED, accessible_bidding_strategy: "", frequency_caps: [], video_brand_safety_suitability: :UNSPECIFIED, payment_mode: :UNSPECIFIED, excluded_parent_asset_field_types: [], excluded_parent_asset_set_types: []>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: smart_campaign_setting_operation: <Google::ads::GoogleAds::V14::Services::SmartCampaignSettingOperation: update: <Google::ads::GoogleAds::V14::Resources::SmartCampaignSetting: resource_name: "customers/4897329142/smartCampaignSettings/-2", campaign: "", phone_number: <Google::ads::GoogleAds::V14::Resources::SmartCampaignSetting::PhoneNumber: phone_number: "(602) 815-2760", country_code: "US">, advertising_language_code: "en", final_url: "https://a23349.p3187.c1.store.godaddywp.com/", business_name: "blank">, update_mask: <Google::Protobuf::FieldMask: paths: ["phone_number.phone_number", "phone_number.country_code", "advertising_language_code", "final_url", "business_name"]>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_criterion_operation: <Google::ads::GoogleAds::V14::Services::CampaignCriterionOperation: create: <Google::ads::GoogleAds::V14::Resources::CampaignCriterion: resource_name: "", campaign: "customers/4897329142/campaigns/-2", display_name: "", type: :UNSPECIFIED, status: :UNSPECIFIED>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: ad_group_operation: <Google::ads::GoogleAds::V14::Services::AdGroupOperation: create: <Google::ads::GoogleAds::V14::Resources::AdGroup: resource_name: "customers/4897329142/adGroups/-3", name: "Test SSC ad group #1712701749184", status: :UNSPECIFIED, type: :SMART_CAMPAIGN_ADS, ad_rotation_mode: :UNSPECIFIED, url_custom_parameters: [], campaign: "customers/4897329142/campaigns/-2", optimized_targeting_enabled: false, display_custom_bid_dimension: :UNSPECIFIED, effective_target_cpa_source: :UNSPECIFIED, effective_target_roas_source: :UNSPECIFIED, labels: [], excluded_parent_asset_field_types: [], excluded_parent_asset_set_types: []>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: ad_group_ad_operation: <Google::ads::GoogleAds::V14::Services::AdGroupAdOperation: create: <Google::ads::GoogleAds::V14::Resources::AdGroupAd: resource_name: "", status: :UNSPECIFIED, ad_group: "customers/4897329142/adGroups/-3", ad: <Google::ads::GoogleAds::V14::Resources::ad: resource_name: "", final_urls: [], final_app_urls: [], final_mobile_urls: [], url_custom_parameters: [], type: :SMART_CAMPAIGN_AD, device_preference: :UNSPECIFIED, url_collections: [], system_managed_resource_source: :UNSPECIFIED>, ad_strength: :UNSPECIFIED,action_items: [], labels: []>>>], partial_failure: false, validate_only: false, response_content_type: :UNSPECIFIED> I, [2024-04-09T22:29:09.690928 #121290] INFO -- : Incoming response (errors): Google::ads::GoogleAds::errors::GoogleAdsError(Google::ads::GoogleAds::errors::GoogleAdsError): The required field was not present.The field attempted to be mutated is immutable. called from: /home/sellbrite/app/lib/requests/google_ads_request_smart_campaign.rb:35:in `create_smart_campaign' Google::ads::GoogleAds::errors::GoogleAdsError: Google::ads::GoogleAds::errors::GoogleAdsError from /home/sellbrite/app/vendor/bundle/ruby/2.7.0/gems/google-ads-googleads-23.1.0/lib/google/ads/google_ads/interceptors/error_interceptor.rb:67:in `rescue in request_response' Caused by GRPC::InvalidArgument: 3:Request contains an invalid argument.. debug_error_string:{UNKNOWN:Error received from peer ipv4:142.251.163.95:443 {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2024-04-09T22:29:09.686892344+00:00"}} from /home/sellbrite/app/vendor/bundle/ruby/2.7.0/gems/grpc-1.61.0-aarch64-linux/src/ruby/lib/grpc/generic/active_call.rb:29:in `check_status'

Additional response examples + code implementation viewable in https://docs.google.com/document/d/1slXm_fk5DK3L3mPJq_cvYgcfQMZxFfL61q6JUBvZ4Pk/edit

Anything else we should know about your project / environment:

@epark-godaddy epark-godaddy added bug Something isn't working triage New issues that need to be sorted into other labels labels Apr 15, 2024
@mcloonan
Copy link
Member

Our smart campaign example doesn't require a Google merchant center ID as a parameter. Can you clarify exactly what code you're running to encounter this behavior?

@epark-godaddy
Copy link
Author

@mcloonan our code can be viewed here

@mcloonan
Copy link
Member

For some reason the error didn't propagate correctly to your side. I looked up what happened on our server logs for this request ID, and the error message there should be more useful:

[{
    error_code: "FieldError.REQUIRED",
    field_path: "mutate_operations[3].campaign_criterion_operation.",
    error_message: "The required field was not present."
  },{
    error_code: "FieldError.IMMUTABLE_FIELD",
    field_path: "mutate_operations[5].ad_group_ad_operation.create.ad",
    error_message: "The field attempted to be mutated is immutable."
  }]

So this means you didn't specify a campaign_criterion_operation that was required, and also that you attempted to mutate the "ad" field which is immutable. So the error isn't actually about the extra fields that appear but you don't specify. I just tested this on my side and they appear in my successful request (using our example as is without modifications) as well.

@epark-godaddy
Copy link
Author

epark-godaddy commented Apr 18, 2024

Hi @mcloonan Thanks for the prompt response and sharing the more helpful error message. I believe I know why the first error (missing a required field) is happening, but would appreciate more information on the immutable "ad" field.

If you see our implementation of def create_smart_campaign_ad_group_ad_operation(campaign) in the previously linked code examples, it closely mirrors that of https://github.com/googleads/google-ads-ruby/blob/main/examples/advanced_operations/add_smart_campaign.rb#L528. Are you able to provide more detail on the discrepancy that you may be seeing between our implementation and the example code that you successfully executed?

@epark-godaddy
Copy link
Author

Hi @mcloonan just following up in case my previous message got buried. We'd appreciate any further direction you're able to share -- thank you!

@mcloonan
Copy link
Member

Looking at your request compared to the example we have, it looks like you're only specifying the ad's type field, but there are a bunch of other required fields as well. See: https://github.com/googleads/google-ads-ruby/blob/main/examples/advanced_operations/add_smart_campaign.rb#L528

The error message I provided for this is not very clear, but if you supply all of the required fields as demonstrated in the example, it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that need to be sorted into other labels
Projects
None yet
Development

No branches or pull requests

2 participants