[error code 13] Internal server error on authentication
jackbillstrom opened this issue · 3 comments
I'm submitting a ...
- bug report ?
- feature request
- question about the decisions made in the repository
- question about how to use this project
Summary
While following the example code given, I tried to make my first request. (Used a python project to get set up with my tokens through a Google login dialog and copied the refreshtoken)
However I'm getting the error Error: 13 INTERNAL: Internal error encountered
, see more below:
I used a invalid login_customer_id aswell and that returns as expected. Granted API-keys to a bigger project I have binded with Google Analytics as well, which permisions works well.
Other information
Code used
const {
GoogleAdsClient,
SearchGoogleAdsRequest,
KeywordMatchTypeEnum,
} = require("google-ads-node");
// // 1. Create a new client with valid authentication
const client = new GoogleAdsClient({
client_id:'my-client-id',
client_secret:'my-secret',
refresh_token:'my-refresh-token',
developer_token:'my-dev-token',
login_customer_id:'123-456-7890',
});
async function example() {
// 2. Load a Google Ads service
const service = client.getService("GoogleAdsService");
// 3. Create a request
const request = new SearchGoogleAdsRequest();
const result = await service.search(request)
.then((data) => {
return data.data
})
.catch((err) => {
console.log("--- Error in search ---");
console.log(err);
})
}
example();
Error
Error: 13 INTERNAL: Internal error encountered.
at Object.exports.createStatusError (/home/the-hive/node-reporter/node_modules/grpc/src/common.js:91:15)
at Object.onReceiveStatus (/home/the-hive/node-reporter/node_modules/grpc/src/client_interceptors.js:1209:28)
at InterceptingListener._callNext (/home/the-hive/node-reporter/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/home/the-hive/node-reporter/node_modules/grpc/src/client_interceptors.js:618:8)
at Object.onReceiveStatus (/home/the-hive/node-reporter/node_modules/google-ads-node/build/lib/interceptor.js:108:17)
at InterceptingListener._callNext (/home/the-hive/node-reporter/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/home/the-hive/node-reporter/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/home/the-hive/node-reporter/node_modules/grpc/src/client_interceptors.js:847:24) {
code: 13,
metadata: Metadata { _internal_repr: {}, flags: 0 },
details: 'Internal error encountered.'
}
Hi @jackbillstrom, it looks like you're forgetting to set any properties on the SearchGoogleAdsRequest
, e.g.
request.setQuery(`
SELECT
campaign.id,
campaign.name,
campaign.status,
segments.device,
metrics.impressions,
metrics.clicks,
metrics.ctr,
metrics.average_cpc,
metrics.cost_micros
FROM campaign
`);
request.setCustomerId("<customer-id>");
See if adding that snippet helps. Don't forget to substitute your customer id. Otherwise, if it still has the error Internal error encountered
, there isn't much we can do unfortunately as this comes from Google's end.
I'd suggest contacting their support if the issue continues.
@kritzware First of all, many thanks for the quick answer. Second, it was helpful!
If you don't mind me asking further 🤓
Passing login_customer_id
now and I'm querying approriate according to permssions right now, however it returned the following:
Error: 16 UNAUTHENTICATED: Authentication of the request failed.
code: 16,
metadata: Metadata {
_internal_repr: {
'google.ads.googleads.v3.errors.googleadsfailure-bin': [Array],
'grpc-status-details-bin': [Array],
'request-id': [Array],
'error-code': [Array],
location: [Array]
},
flags: 0
},
details: 'Authentication of the request failed.'
}
Any ideas? 👀
@kritzware First of all, many thanks for the quick answer. Second, it was helpful!
No worries, glad that issue was resolved!
Any ideas? 👀
Authentication with the Google Ads API is quite complex, and difficult to get working initially (from experience). All I can suggest is double check the official documentation, and ensure you're definitely using the correct tokens/customer ids.
We also have a helper ui for generating a refresh token: https://refresh-token-helper.opteo.com/