google-ads-node (low-level Google Ads gRPC client)
raw JSON → 23.0.0 verified Sat Apr 25 auth: no javascript
A low-level Google Ads API client library for Node.js, generated from the experimental Bazel build files. This package is the compiled output of protobuf definitions and requires manual setup, no user-facing documentation is provided. The current version (23.0.0) corresponds to Google Ads API v23. The package is maintained by Opteo but is not recommended for direct use; instead, use the higher-level wrapper google-ads-api. Releases are tied to Google Ads API versions. Key differentiator: it provides raw gRPC stubs for advanced users who need custom control.
Common errors
error Cannot find module 'google-ads-node' ↓
cause Package not installed or import path incorrect.
fix
Run
npm install google-ads-node and ensure the import uses the full package name. error TypeError: GoogleAdsClient is not a constructor ↓
cause Default import used but the package only exports named exports.
fix
Change import to
import { GoogleAdsClient } from 'google-ads-node'. error Error: AuthenticationError.GOOGLE_ACOUNT_NOT_FOUND ↓
cause Missing or invalid developer token or OAuth credentials.
fix
Verify that your developer token and OAuth2 credentials are correct and set in environment variables.
error Error: Request is missing required field customer_id ↓
cause The request object does not include `customerId` in the correct format (usually string of 10 digits).
fix
Add
customerId: '1234567890' (without dashes) to the request. error Error: Invalid version: V23 is not a valid version ↓
cause Attempting to use an API version that is not supported by the library.
fix
Use the version that matches the library version (e.g., v23 for google-ads-node@23.0.0).
Warnings
gotcha This library is the raw compiled output of experimental build files; it has no user-friendly documentation and requires manual protobuf handling. ↓
fix Use the high-level library google-ads-api instead if you want a documented, easy-to-use client.
breaking Major version updates correspond to Google Ads API major versions; breaking changes occur in service APIs, types, and enums. ↓
fix Refer to Google Ads API release notes and the package's changelog for migration steps between major versions.
deprecated Some service methods or types may be marked as deprecated in Google Ads API v23; use the latest version to avoid broken functionality. ↓
fix Check the Google Ads API deprecation schedule and update your code to use the recommended alternatives.
gotcha The package is ESM via TypeScript compilation but the published npm package may include CommonJS files. Import resolution can be tricky. ↓
fix Ensure your project uses Node ESM (type: module in package.json) or use require if sticking to CommonJS.
Install
npm install google-ads-node yarn add google-ads-node pnpm add google-ads-node Imports
- GoogleAdsClient wrong
const GoogleAdsClient = require('google-ads-node').GoogleAdsClientcorrectimport { GoogleAdsClient } from 'google-ads-node' - services wrong
const { services } = require('google-ads-node')correctimport { services } from 'google-ads-node' - types
import { types } from 'google-ads-node' - enums wrong
const { enums } = require('google-ads-node').enumscorrectimport { enums } from 'google-ads-node'
Quickstart
import { GoogleAdsClient, services, enums } from 'google-ads-node';
async function main() {
const client = new GoogleAdsClient({
developerToken: process.env.DEVELOPER_TOKEN ?? '',
clientId: process.env.CLIENT_ID ?? '',
clientSecret: process.env.CLIENT_SECRET ?? '',
refreshToken: process.env.REFRESH_TOKEN ?? '',
});
const customerId = '1234567890';
const campaignService = new services.GoogleAdsServiceClient(client);
const request = {
customerId: customerId,
query: `SELECT campaign.id, campaign.name FROM campaign WHERE campaign.status = 'PAUSED'`,
};
try {
const response = await campaignService.search(request);
console.log(JSON.stringify(response, null, 2));
} catch (err) {
console.error(err.errors);
}
}
main();