Unknown error while using HTTP Node for some credentials?

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

Hi @michaelnguyen, I am very sorry for the trouble.

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.

We’ve seen a few reports about OAuth2 token refresh attempts failing recently, but unfortunately n8n’s logging around this is very limited to put it mildly, so I am still struggling to understand when exactly this is happening.

Even more so as from the sounds of it this is working fine with other accounts of yours. Is there a chance the account in question has been limited in any way by Google?

Just to update, we’ve added on a few more accounts and they do not exhibit the same auth refresh issue, so I believe it’s unrelated to our GCP oauth app/project.

Is there a chance the account in question has been limited in any way by Google?

Regarding this, I’ll see if I can create another test application (or find an app to test with) to see if it’s an issue specifically with the account in question to see if new connections all have the 1 hour refresh issue.

There are not really any hints as to the account being limited by Google as far as I can tell because they are able to perform pretty much all actions under our Google workspace and their YouTube account is still active and streaming.

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