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

Can not create CampaignBudget on version 5.1.1 #243

Closed
nmluancs opened this issue Mar 22, 2021 · 9 comments
Closed

Can not create CampaignBudget on version 5.1.1 #243

nmluancs opened this issue Mar 22, 2021 · 9 comments
Labels
bug ⚠️ Something isn't working in the library

Comments

@nmluancs
Copy link

nmluancs commented Mar 22, 2021

After upgrading google-ads-api to 5.1.1, i can not create a campaign budget:
If i did not set total_amount_micros, i got error total_amount_micros: Too low
If it set total_amount_micros, i got error:

GoogleAdsError {
  error_code: ErrorCode { request_error: 1 },
  message: 'The error code is not in this version.',
  trigger: Value { string_value: '' },
  location: ErrorLocation {
    field_path_elements: [ 
       FieldPathElement { field_name: 'operations', index: 0 },
       FieldPathElement { field_name: 'create' },
       FieldPathElement { field_name: 'total_amount_micros' }
    ]
  }
}

Here is my testing code:

const campaignBudget = new resources.CampaignBudget({
      name: 'TestA1',
      amount_micros: toMicros(500000),
      delivery_method: "STANDARD",
      explicitly_shared: false,
      period: "DAILY",
      // total_amount_micros: toMicros(500000 * 30.4),
      type: "STANDARD",
    });
    const options: MutateOptions = {
      validate_only: true
    };

    try {
      const res = await adsCustomer.Customer.campaignBudgets.create([campaignBudget], options);
    } catch(ex) {}
@nmluancs nmluancs changed the title Can not create CampaignBudget Can not create CampaignBudget on version 5.1.1 Mar 24, 2021
@nmluancs
Copy link
Author

nmluancs commented Apr 2, 2021

It seems there is problem in converting between resource interface to entity class.
If i use resources.ICampaignBudget, it works.

const campaignBudget : resources.ICampaignBudget = {
name: 'TestA1',
amount_micros: toMicros(500000),
delivery_method: "STANDARD",
explicitly_shared: false,
period: "DAILY",
// total_amount_micros: toMicros(500000 * 30.4),
type: "STANDARD",
};
const options: MutateOptions = {
validate_only: true
};

try {
  const res = await adsCustomer.Customer.campaignBudgets.create([campaignBudget], options);
} catch(ex) {}

@nmluancs
Copy link
Author

nmluancs commented Apr 5, 2021

Hello devs,
After reading source code, i think the problem is that in interface, all fields allow null but when implement in class those fields no longer support null.
For example:

  • in CampaignBudget : amount_micros, total_amount_micros has type of number with default value is 0 so that if i did not set total_amount_micros, i will get the error (total_amount_micros too low)

This problem happens in all implemented class and it takes a lot of bugs.
Please have a look. Thank you

@nmluancs
Copy link
Author

nmluancs commented Apr 6, 2021

Hmm, sorry. It seems Google protobuf doesn't support nullable field

@wcoots wcoots added the bug ⚠️ Something isn't working in the library label Apr 19, 2021
@wcoots
Copy link
Contributor

wcoots commented Apr 19, 2021

Hi @nmluancs. We are aware of this issue and are waiting on a fix in the node-js gapic library. Once this has been done we will release with the fix.

@rosslavery
Copy link

rosslavery commented Apr 20, 2021

Just to chime in that I'm affected by this as well. Also getting other errors for atomic mutations that weren't there before our migration. We've never had to specify fields like final_url_suffix while creating a campaign before.

In the meantime we've rolled back to library 4.x.

E.g.:

{
      "error_code": {
        "field_error": "INVALID_VALUE"
      },
      "message": "The field's value is invalid.",
      "trigger": {
        "string_value": ""
      },
      "location": {
        "field_path_elements": [
          {
            "field_name": "mutate_operations",
            "index": 2
          },
          {
            "field_name": "campaign_operation"
          },
          {
            "field_name": "create"
          },
          {
            "field_name": "final_url_suffix"
          }
        ]
      }
    },

Seems like may be related to googleapis/gapic-generator-typescript#848 specifically, since final_url_suffix is marked as optional and gcpic is not honouring it.

@Zikoel
Copy link

Zikoel commented Apr 29, 2021

Good news, the googleapis/gapic-generator-typescript#848 was marked as done!!

@wcoots
Copy link
Contributor

wcoots commented Apr 30, 2021

Yes indeed. We will implement that along with google-ads v7 next week.

@wcoots
Copy link
Contributor

wcoots commented May 26, 2021

@nmluancs @rosslavery @Zikoel The latest version of the API has been released under v5.2.0 of this library. Upgrading should hopefully fix your issue. If not then feel free to reopen this issue.

@wcoots wcoots closed this as completed May 26, 2021
@spicy-sauce
Copy link

Hello,
I'm using version 5.2.0 and when trying to set a campaignBudget with total_amount_micros, getting this result:

  errors: [
    GoogleAdsError {
      error_code: ErrorCode { request_error: 1 },
      message: 'The error code is not in this version.',
      trigger: Value { string_value: '' },
      location: ErrorLocation {
        field_path_elements: [
          FieldPathElement { field_name: 'operations', index: 0 },
          FieldPathElement { field_name: 'create' },
          FieldPathElement { field_name: 'total_amount_micros' }
        ]
      }
    }
  ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ⚠️ Something isn't working in the library
Projects
None yet
Development

No branches or pull requests

5 participants