Google Ads node 403 / 400 error

Google Ads node outputs a 403 error while trying to GET information from the account.

I want to get information of all campaigns from my Google Ads account.

After inserting the credentials, Manager ID, Account ID, and depending on if I add a developer token I encounter a 403 or 400 error in the Google Ads node.

Perhaps any of you know what the issue is and could provide me a solution to apply? Thank you in advance for your help.

Best,
Jfer

Hi @jfer, welcome to the community and I am very sorry for the inconvenience this causes. This node has caused quite a bit of headache recently. Unfortunately, Google doesn’t let me add my Google Ads test account to my manager account for whatever reason, so I have not managed to reproduce this myself so far.

Could you share your workflow and the n8n version you are currently using with us as well as the exact error message you are getting?

Hi Tom, thanks for your quick reply. My workflow is nothing more than the start node and Google Ads node. In my case I want to extract data from Google Ads and then as next step allocate in Elasticsearch. However, since it is the first step I know that is the issue.

GOOGLE ADS

The n8n version I am using is: 0.187.2

First error:
ERROR: UNKNOWN ERROR - check the detailed error for more information

Request failed with status code 403

NodeApiError: UNKNOWN ERROR - check the detailed error for more information
    at RoutingNode.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/RoutingNode.js:88:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:630:23)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:557:53

Second Error:

ERROR: UNKNOWN ERROR - check the detailed error for more information

Request failed with status code 400

NodeApiError: UNKNOWN ERROR - check the detailed error for more information
    at RoutingNode.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/RoutingNode.js:88:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:630:23)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:557:53

Hi @jfer, could you try upgrading to the latest n8n version and ensure you are using valid IDs for both your manager and customer accounts? Upgrading to [email protected] should return a few more details about the error (including the query sent to the Google Ads API under the config object) which hopefully helps with understanding what’s wrong here:

It would also be great if you could share the full data of your Ads node. Simply select it on your canvas and press Ctrl+C to copy the JSON description of the node, then paste it here on the forum.

Hi Tom, I have upgraded to version 0.199.0. Still some errors are appearing. When we erase the developer token an error Bad request - please check your parameters appear. Does that means we need to have a developer token for the node to work?

On the other hand, once we add the Google Ads developer token, a node error NodeApiError: Forbidden - perhaps check your credentials?

{“context”:{},“name”:“NodeApiError”,“cause”:{“message”:“Request failed with status code 403”,“name”:“Error”,“stack”:“Error: Request failed with status code 403\n at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)”,“config”:{“url”:“/v9/customers/xxxxxxxx/googleAds:search”,“method”:“post”,“data”:“{"query":"select campaign.id, campaign.name, campaign_budget.amount_micros, campaign_budget.period,campaign.status,campaign.optimization_score,campaign.advertising_channel_type,campaign.advertising_channel_sub_type,metrics.impressions,metrics.interactions,metrics.interaction_rate,metrics.average_cost,metrics.cost_micros,metrics.conversions,metrics.cost_per_conversion,metrics.conversions_from_interactions_rate,metrics.video_views,metrics.average_cpm,metrics.ctr from campaign where campaign.id > 0 "}”,“headers”:{“Accept”:“application/json, text/plain, /”,“developer-token”:“xxxxxxxxxxxxx”,“login-customer-id”:“xxxxxxxxxx”,“Authorization”:“Bearer ya29.a0Aa4xrXOVIf9i2Bw3R2ScE5C3Bsp8zrx0jl32wkNYJqyGqspYmQazp7soxlc0EMf03p76Fh5lTUXqyIIB2anKsG3rruBweUzzwyCdWNiQ75xgJ4834f1tWN0aGk4wuMxD4LPk2g-cqRt6EXJtRFIJH9C3kTZVaCgYKATASARESFQEjDvL9-c0gmPHjITRfNxI1LUNRrQ0163”,“User-Agent”:“n8n”,“Content-Type”:“application/json”,“Content-Length”:504},“params”:{},“baseURL”:“https://googleads.googleapis.com”,“transformRequest”:[null],“transformResponse”:[null],“timeout”:300000,“xsrfCookieName”:“XSRF-TOKEN”,“xsrfHeaderName”:“X-XSRF-TOKEN”,“maxContentLength”:-1,“maxBodyLength”:-1,“transitional”:{“silentJSONParsing”:true,“forcedJSONParsing”:true,“clarifyTimeoutError”:false},“axios-retry”:{“retryCount”:0,“lastRequestTime”:1666615280310}}},“timestamp”:1666615280524,“message”:“Forbidden - perhaps check your credentials?”,“node”:{“parameters”:{“resource”:“campaign”,“operation”:“getAll”,“campaigsNotice”:“”,“managerCustomerId”:“xxxxxxxxx”,“clientCustomerId”:“xxxxxxxxx”,“additionalOptions”:{}},“id”:“xxxxxx-xxxxxx-xxxxxxxx”,“name”:“Google Ads”,“type”:“n8n-nodes-base.googleAds”,“typeVersion”:1,“position”:[1040,480],“credentials”:{“googleAdsOAuth2Api”:{“id”:“8”,“name”:“Google Ads account”}}},“httpCode”:“403”,“description”:“The caller does not have permission”}

I tried to take like a screenshot of the workflow as I have seen in other posts but I couldn’t. So sorry for it.

Hi @jfer, many thanks for confirming. Yes, my understanding is that the developer token is always required.

The 403 “Forbidden” error might suggest that your management account doesn’t have access to the customer account specified by the respective IDs. These IDs would need to be entered without dashes. Could you double check that the management account you have authenticated with can access the customer account you are trying to read data from?

Hi Tom, I confirm that the Manager account has access to the customer account with the IDs without dashes. The only thing that may be causing the error then is the developer token. I will double-check that. Besides it, any other suggestion?

Yes, there is one more possible problem I can spot - the node uses v9 of the Google Ads API which from looking at their documentation is no longer supported as of October 2022. @Jon is currently looking into migrating the node to the new Google Ads API version, so once that update has been released we should be able to rule out the API version as a possible cause.

Hey @jfer,

I have just put in a PR that will fix this here feat(Google Ads Node): update api version to v11 by Joffcom · Pull Request #4427 · n8n-io/n8n · GitHub

It is probably also worth double checking under the API access for your Manager account that the Access level is not Test Account as if it is you will only be able to access data from test accounts (marked with a red icon) and not live accounts.

1 Like

Hi @MutedJam, thanks for the heads-up about the API. That is a good hint of the issue. @Jon, thanks for your message, I will check that right away. In future scenario how can I know when the new API connection with Google Ads is done?

Thank you both for the help.

Hey @jfer,

Keep an eye on the release notes :slight_smile: although we will pop a message here when released. I suspect it will be either in the release for this week or next week so not long to go.

2 Likes

@Jon Thank you very much for your help!

just for future knowledge, having API Access as “Test Account” is not valid. I made the change and it works now. Thanks so much for the help!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.