No refresh token (Google Big Query OAuth2)

Hello n8n community,

I’d just like to start off by thanking you for all of your amazing work, we absolutely love working with n8n.

Regarding our problem - we are working on using n8n as an ETL, to transfer data from all of our data sources (HubSpot, our webapp, emailing tools, etc.) into Google Big Query tables.

However, we are encountering a problem with the Refresh Token. We are using OAuth2 with the following setup:

After an initial connection, we are able to stream data into the Big Query tables for about an hour before the workflow starts failing for the following reason:

ERROR: Error: No refresh token

Error: Error: No refresh token
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest.node.js:806:27)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:416:47```

Opening the credentials and reconnecting will give us a new valid token for another hour.

Has anyone else encountered a similar issue?

Thanks,
Maxim

Hey @maximpoulsen!

Welcome to the community :tada:

Thank you for your love!

We recently added the Google BigQuery node. You can use the node to create and get your records. If there’s any specification functionality that the node is missing please let us know by creating a feature request :slight_smile:

Hey @maximpoulsen!

Were you able to get it working with the Google BigQuery node?

Hi @harshil1712!

Thanks for following up.

We are having some trouble updating n8n on Heroku, updating the N8N_VERSION config variable isn’t working as intended. It’s building to 0.112.0 for some reason.

I have pinged my CTO for assistance and will get back to you as soon as I have any news!

1 Like

Hi again @harshil1712!

We just got it up and running - and it works great!

It would be amazing to be able to query a specific table to return not all values but for example the answer to an SQL query.

We had this working with a HTTP request if it can help :slight_smile:

{
  "nodes": [
    {
      "parameters": {
        "authentication": "oAuth2",
        "requestMethod": "POST",
        "url": "=https://bigquery.googleapis.com/bigquery/v2/projects/[project_name]/queries",
        "options": {},
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "query",
              "value": "=SELECT act.campaign_id FROM [project_name] as act\nLEFT JOIN [project_name] as camp\nON act.campaign_id = camp.campaign_id\nWHERE camp.campaign_id IS NULL\nGROUP BY act.campaign_id"
            },
            {
              "name": "useLegacySql",
              "value": "false"
            }
          ]
        },
        "headerParametersUi": {
          "parameter": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "queryParametersUi": {
          "parameter": [
            {
              "name": "key",
              "value": "[KEY]"
            }
          ]
        }
      },
      "name": "Get campaigns",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        -200,
        200
      ],
      "notesInFlow": true,
      "credentials": {
        "oAuth2Api": "Google Big Query OAuth 2"
      },
      "notes": "- group by campaign\n- left join + null\n- add remaining"
    }
  ],
  "connections": {}
}

Thanks for your help!

1 Like

Hey @maximpoulsen!

Awesome! Good to know that it works for you now :tada:

Can you open a Feature Request post for the functionality you need? It would help us if you can share some more details there :slight_smile:

1 Like

Had the exact same problem using the Youtube Data API, but no native Node there to save me :confused:

Turns out, by looking at how other Google Node were implemented in the github repo (credential folder), I found that Google credentials need to be set at “Body” in the Authentication dropdown not “Header”

And then it worked like a charm !
You can also regularly schedule a simple get call in order to refresh the token (if like me you are in test and your refresh token expires after 7 days of inactivity)

Hopes it helps someone !

Hey I have a similar thing but I am trying to connect to Google Cloud API. The scope I need is missing so had to do a custom OAuth2. I think my token only lasts an hour or so? I have to sign in with my google in order to refresh it… Do you have an example of a GET call I can do? Just starting out