Opteo / google-ads-api

Google Ads API client library for Node.js
https://opteo.com
MIT License
269 stars 90 forks source link

Error "Mutate operations must have 'create', 'update', or 'remove' specified" while creating account budget #289

Open douglas-pires opened 3 years ago

douglas-pires commented 3 years ago

Hi folks, it's me again! 👋🏻

Package version: 5.2.0

While trying to create an account_budget with:

customer.mutateResources([
  {
    entity: "account_budget",
    resource: billing_setup_request,
    operation: "create"
  }
]),

or with

customer.billingSetups.create([billing_setup_request])

or even

customer.billingSetups.create([new resources.BillingSetup(billing_setup_request)]),

In all cases I have the same error:

image

eliotik commented 3 years ago

Just to add more colors to this, doing some investigation, inside service, we have this method: buildMutationRequestAndService, which calls services.MutateOperation. In a normal flow, it should return a mutate_operations array with the getter to the operator: image When trying to create the account_budget, or billing_setup the get accessor is undefined. image So, I think something happens inside google-ads-node, that doesn’t have a correct mapping. But I’m totally guessing here. The google-ads-node repository seems to be minified and the code is not that clear.

eliotik commented 3 years ago

We turned grpc logging Request headers:

        :method: POST
        :path: /google.ads.googleads.v7.services.GoogleAdsService/Mutate

(I omitted all the rest parameters)

We added some debug info and found that we send next buffer:

{
  message: <Buffer 00 00 00 00 0c 0a 0a 36 34 39 39 37 34 37 30 34 39>,
  flags: undefined
}

which encoded to:


6499747049

Seems pretty empty.

When we tried to do mutation operation to update customer name to compare payload bodies, payload was:


6499747049m�j
E
customers/6499747049�,NEW NAME FOR TEST ACCOUNT!
resource_name
descriptive_name (

Which seems good and it worked without error.

So for billing setup it seems we send to Google Ads API empty payload and that is why we get back error: Mutate operations must have 'create', 'update', or 'remove' specified

@kritzware can you please take a look?

kritzware commented 3 years ago

Thanks for all the details from both of you. I'm able to recreate this on my end and am looking into it 👍

kritzware commented 3 years ago

So it seems like the proto MutateOperation is missing the key billing_setup_operation, which would explain why the data is missing when being converted to a binary message. Thanks for finding that @eliotik.

This library seems to handle everything correctly and passes the data down to google-ads-node and the gapic client correctly, so I'm fairly certain this is what's causing the issue. I'll message our Google contacts and see what they think.

eliotik commented 3 years ago

Hi @kritzware thank you for looking into it.

eliotik commented 3 years ago

@kritzware hi, how do you get protobufs to repository?

kritzware commented 3 years ago

@eliotik the proto files are compiled over in the google-ads-node repository. Specifically they're pulled in during the build process of a Docker container (done this way so it's easier to run reliable builds across our team). You can find the line that does this here: https://github.com/Opteo/google-ads-node/blob/master/Dockerfile#L22

The proto files are hosted in the googleapis/googleapis repository.

eliotik commented 3 years ago

Thank you @kritzware . Regarding MutateOperation, it seems it's never had it, look in v4 https://github.com/googleapis/googleapis/blob/d76f26f335b2b570b7e19d938f35f9894236e565/google/ads/googleads/v4/services/google_ads_service.proto#L697

eliotik commented 3 years ago

Hi @kritzware sorry for bothering you, do you have any news? There is a chance that google suspends accounts without billing info but with campaigns. We create hundrends of accounts and add camapings into them, and manually add billing info to new accounts. But for those accounts we didn't add billing info we started to have suspenssions.

wcoots commented 3 years ago

@eliotik we will raise the issue with our Google contacts next time we speak to them

eliotik commented 3 years ago

Hi @WillCooter do you have any news?

rosslavery commented 2 years ago

@WillCooter @kritzware Just checking on this one in case Google has gotten back to you.

I believe https://github.com/Opteo/google-ads-api/issues/316 https://github.com/Opteo/google-ads-api/issues/331 and this error are all related.

Even in the v9 protos there are a number of operations missing (I've personally encountered the same issues when mutating customer_user_access_invitation and customer_user_access resources)

Edit: In the interest of getting this solved, I've also tried reaching out to some contributors to the above repo via email without any response :/

Ma-Der commented 2 years ago

Problem still occurs

sheyDev commented 2 years ago

Any solution or workaround for this? Basically we need a way to create a new billing setup for an account. If anyone has any ideas please let us know, your help would greatly appreciated.

sheyDev commented 2 years ago

Anyone looking for a alternative solution, you can use the REST api to create a billingSetup https://developers.google.com/google-ads/api/rest/reference/rest/v9/customers.billingSetups/mutate#BillingSetupOperation

However, if you're trying to create a billing setup for a sub account under a manager account, we run into this error errorCode: { billingSetupError: 'NO_SIGNUP_PERMISSION' }

Based on this thread https://groups.google.com/g/adwords-api/c/QhkOYO5bzqE/m/23GwhAY6AwAJ, it's a problem on google's end.

alexmcode commented 1 year ago

@eliotik how do you turn on grpc logging?