Opteo/google-ads-node

[v3] Argument mismatch in "makeUnaryRequest" on ListAccessibleCustomersRequest

xpirt opened this issue · 7 comments

xpirt commented

I'm submitting a ...

  • bug report
  • feature request
  • question about the decisions made in the repository
  • question about how to use this project

Summary

There seems to be an issue with the ListAccessibleCustomersRequest API call on latest Google Ads v3.
This piece of code throws an Argument mismatch error and doens't work as expected:

import { GoogleAdsClient, ListAccessibleCustomersRequest } from 'google-ads-node'

const client = new GoogleAdsClient({
    client_id: CLIENT_ID,
    client_secret: CLIENT_SECRET,
    developer_token: DEVELOPER_TOKEN,
    refresh_token: REFRESH_TOKEN
})

const service = client.getService('CustomerService')

const request = new ListAccessibleCustomersRequest()
const response = await service.listAccessibleCustomers(request) // throws the error

The same exact code works fine on API v2, and on latest version this API has not been changed.

Other information

The error thrown is: Argument mismatch in "makeUnaryRequest" (from grpc dependency)

Hi @xpirt, thanks for reporting this. I'll make sure to take a look into the issue.

I also experienced the same and currently, as a temporary work-around, the following code does the job (make sure parseData is enabled in the client):

const response: string[] = await new Promise((resolve, reject) => {
  service.listAccessibleCustomers(request, (err: any, result: any) => {
    if (err) {
      reject(err);
    } else {
      resolve(result.resourceNames);
    }
  });
});

@basimkhajwal Thank you good man

@kritzware, Sorry for the bump, but I was curious about any headway on this bug. I'm running into the same original error of Argument mismatch in "makeUnaryRequest". In trying @basimkhajwal's temporary solution, I get a different error of Error: 13 INTERNAL: Internal error encountered..

Looks like the error may have been on my end (I'm still trying to wade through all the documentation). I was including a login_customer_id in my GoogleAdsClient options object which was causing the Error 13 message. I'm not sure why including that number is incorrect, however, since it's the id of a test manager account that has two fake accounts as children.

With removing the login_customer_id field, I'm not getting an array of "resources" that I'm affiliated with, three of which are other manager accounts. I was hoping this http request would give me a list of accounts that are under the umbrella of a manager account.

As an aside, I still get the Argument mismatch in "makeUnaryRequest" error if I don't use the pattern that @basimkhajwal displayed though.

Leaving a final comment here, I did a test where I included the same login_customer_id but I removed the hyphens. So it went from 000-000-0000 to 000000000, and that didn't cause an error (although it still only gave me manager accounts that I'm affiliated with).

This should be resolved now, and we recommend using google-ads-api which now supports Google Ads API v6.1.