Describe the problem/error/question
I am trying to automate pulling some data from YouTube Analytics using the following endpoint and (sample) query:
https://youtubeanalytics.googleapis.com/v2/reports?currency=USD&dimensions=channel&endDate=2023-03-25&ids=channel%3D%3DMINE&metrics=likes%2CestimatedMinutesWatched%2CsubscribersGained%2CsubscribersLost%2CestimatedRevenue&startDate=2023-03-19
The response (with some information redacted/substituted) looks something like this:
[
{
"kind": "youtubeAnalytics#resultTable",
"columnHeaders": [
{
"name": "channel",
"columnType": "DIMENSION",
"dataType": "STRING"
},
{
"name": "likes",
"columnType": "METRIC",
"dataType": "INTEGER"
},
{
"name": "estimatedMinutesWatched",
"columnType": "METRIC",
"dataType": "INTEGER"
},
{
"name": "subscribersGained",
"columnType": "METRIC",
"dataType": "INTEGER"
},
{
"name": "subscribersLost",
"columnType": "METRIC",
"dataType": "INTEGER"
},
{
"name": "estimatedRevenue",
"columnType": "METRIC",
"dataType": "FLOAT"
}
],
"rows": [
[
"UCxxxxxxxxxxxxxxxxx",
500,
20000,
100,
50,
180.00
]
]
}
]
To access this data, OAuth is required and scopes are required to be set by myself in the associated Google Cloud Project.
The scopes are
https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.channel-memberships.creator https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/youtubepartner https://www.googleapis.com/auth/yt-analytics-monetary.readonly https://www.googleapis.com/auth/yt-analytics.readonly
The OAuth settings for the GCP project are then configured for external accounts as an “in production” app since YouTube accounts can only be connected as an external account. Given that we are able to pull the data for other accounts regularly without issue, I’m not sure why this account which was one of the first that we added is having trouble until we manually reconnect the credential. About an hour later, the credential has to be manually reconnected before data can be accessed again. The above sample response is normally what we get until about an hour later which the credential begins to error.
I am not sure if this is an issue on my end since the error is not particularly helpful unless someone can give me a clue as to what I can assume about it. Since it stops working after an hour, it seems like the credential might not be refreshing properly?
What is the error message (if any)?
The following error is given after about an hour passes from reconnecting the credential:
ERROR: UNKNOWN ERROR - check the detailed error for more information
Cause:
{
"status": "rejected",
"reason":{
}
}
Stack:
NodeApiError: UNKNOWN ERROR - check the detailed error for more information
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V2/HttpRequestV2.node.js:894:27)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:653:28)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:590:53
Please share your workflow
Regarding the shared workflow, we actually are merging over 10 different channels and outputting that data to a spreadsheet, but I’ve removed the extraneous nodes/information. All other channels are fine aside from a single one giving this error. We use a cron node and automatically set the date range that we want, but in this example, the date provided is a static period.
Information on your n8n setup
-
n8n version:
0.221.2 -
Running n8n via (Docker, npm, n8n cloud, desktop app):
n8n cloud