Google Drive - Upload File Node cannot work with Service Account authentication

Describe the problem/error/question

We use the Google Drive - Upload File node. Client provides us service account for authentication.

However, we received error message when execute the step. Please see it in the next session.

We switch to “Google Drive OAuth2 API”. We do not see this error message anymore. But we have to use the service account to do authentication. Please kindly let us know the solution. Thank you!

If can run successfully without any issue. Please kindly let us know how to fix it.

What is the error message (if any)?

{
  "errorMessage": "Request failed with status code 403",
  "errorDetails": {},
  "n8nDetails": {
    "n8nVersion": "1.105.3 (Cloud)",
    "binaryDataMode": "filesystem",
    "stackTrace": [
      "AxiosError: Request failed with status code 403",
      "    at settle (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/core/settle.js:19:12)",
      "    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/adapters/http.js:599:11)",
      "    at IncomingMessage.emit (node:events:530:35)",
      "    at endReadableNT (node:internal/streams/readable:1698:12)",
      "    at processTicksAndRejections (node:internal/process/task_queues:90:21)",
      "    at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/core/Axios.js:45:41)",
      "    at processTicksAndRejections (node:internal/process/task_queues:105:5)",
      "    at invokeAxios (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:313:10)",
      "    at Object.httpRequest (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:898:17)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Google/Drive/v2/actions/file/upload.operation.ts:142:22",
      "    at processInChunks (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Google/Drive/v2/helpers/utils.ts:157:3)",
      "    at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Google/Drive/v2/actions/file/upload.operation.ts:140:3)",
      "    at ExecuteContext.router (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Google/Drive/v2/actions/router.ts:29:26)",
      "    at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Google/Drive/v2/GoogleDriveV2.node.ts:25:10)",
      "    at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1212:9)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1582:27",
      "    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2158:11"
    ]
  }
}

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite): N/A
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: Mac OS + Chrome

Hi @James_Z,

The 403 error suggests there might be an issue with your service account setup. Please verify that the service account is configured correctly - here’s a link to our docs: Google Service Account | n8n Docs

Since OAuth2 works but service account doesn’t, it’s likely a permissions issue rather than an n8n problem.

Hi @Shireen,

Thanks for the reply.

Actually I did some researches in the community. And notice this thread.

Some users also feedback the Upload File node cannot work with service account after the n8n upgrade. Looks like there is something wrong.

Maybe n8n team can take a look and do some checking. Thank you!

I was having the same problem with Service Account. I just switched to OAuth2 and directly uploaded my files to my desired folder. Worked like a charm.

Hi Yurtgoktug,

Thanks for replying the thread.

Yes. I tried the same. OAuth2 works fine. However, our client’s IT team has a preference with service account. Because other than OAuth2 client account and access key, you still need to have another user account to authenticate when connect with Google Drive.

Are you using community license?

Service Account and Google Drive node does not work. Did everything n8n docs suggested, have shared all necessary folders and drives with service account, gave all required permissions to service account. Nothing helped, would always get 403 forbidden quota limit.

Manually rebuilt upload process to GDrive with http nodes, using the same folders, credentials, all worked on the first try, files has been uploaded. Zero changes to service accounts for google drive structures was done before using http nodes.

100% there is some kind of a bug inside google drive node when handling file upload to shared folder. On service account credential screen there is flag for hhtp request node, where we can add scopes, maybe that is not passed to gdrive node.

@Shireen

Hi @automatador

There was a bug in Google drive Node but it solved in fix(GoogleDrive Node): Fix google service accounts uploading to shared drives by maspio · Pull Request #18952 · n8n-io/n8n · GitHub could you please update you n8n version to 1.111.* and let me know if you are still facing any issues

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