Opteo / google-ads-api

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

TypeError: this.auth.getUniverseDomain is not a function #485

Closed julesyoungberg closed 9 months ago

julesyoungberg commented 9 months ago

I recently started getting this error any time I use the API (whether mutations or reports):

TypeError: this.auth.getUniverseDomain is not a function
    at GrpcClient.createStub (/.../node_modules/google-gax/src/grpc.ts:418:48)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Unfortunately this stack trace is not very useful.

This is really odd because it seems to have started suddenly. I recently upgraded to v14 from v13, but it worked fine when I first updated. This error seems to have started occurring yesterday.

This is how I am attempting to create a report, but again it seems to happen for any request. The error is getting thrown during the query function.

const client = new GoogleAdsApi({
    client_id: clientId,
    client_secret: clientSecret,
    developer_token: developerToken,
});

const customer = client.Customer({
    customer_id: customerId,
    refresh_token: refreshToken,
});

const reportRows = await customer.query(`
    SELECT campaign.id FROM campaign LIMIT 20
`);
julesyoungberg commented 9 months ago

I resolved this by running npm i google-gax@~4.2.0. It seems there are breaking changes in 4.3.0.