Problem: Google drive OAuth 2.0 credential setup failing in private k8s environment

Hello,

I am new to n8n so I would greatly appreciate any guidance you can offer.

Environment Setup: I’m running my project within a private corporate network on a k8s environment. Inside this setup, I’ve deployed n8n and attached ingress. The domain we’re using is not accessible from outside the network; it is entirely internal.

Issue Description: To use Google Drive, I’m trying to generate the necessary credentials but have encountered difficulties. Here’s what I’ve done so far:

  1. I’ve successfully created an OAuth 2.0 client in GCP.
  2. I set the redirect URL correctly as per the instructions.
  3. After clicking the “Sign in with Google” button, I select my account and click allow access. It seems like the callback value is generated correctly, shown as:

callback url

https://{private_domain_name}.net/rest/oauth2-credential/callback?state=eyJ0b2tlbiI6IjNMOXVZSUxiLXZUS3B0T1VZLXhWQzVIc2VvN0RrdDRlMVJiayIsImNpZCI6ImVuMmFIZXlsZXJ6cXdmZXEiLCJjcmVhdGVkQXQiOjE3MzMzMDE0OTMxNTh9&code=4/0AeanS0a3csQHJc7w9pweC3yQ4ign7fBaaZvEpDNRLXfeY6xvJmMQ3-Fw49fTLNZjbGhwvA&scope=https://www.googleapis.com/auth/drive%20https://www.googleapis.com/auth/drive.appdata%20https://www.googleapis.com/auth/drive.photos.readonly

Detailed Environment Variables:
DB_POSTGRESDB_DATABASE: n8n
DB_POSTGRESDB_HOST: n8n-postgres
DB_POSTGRESDB_USER: n8n
DB_TYPE: postgresdb
N8N_DEFAULT_LOCALE: ko
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: ‘true’
WEBHOOK_URL: https://private_domain_name

Time-out Logs:

User settings loaded from: /home/node/.n8n/config
Invalid number value for N8N_PORT: tcp://10.231.63.168:80
Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 1.70.1
Locale: ko

Editor is now accessible via:
http://localhost:5678/
2024-12-04T09:00:29.432Z [Rudder] error: Response error code: ETIMEDOUT
2024-12-04T09:02:40.501Z [Rudder] error: Response error code: ETIMEDOUT
Error fetching feature flags Error [PostHogFetchNetworkError]: Network error while fetching PostHog
    at new PostHogFetchNetworkError (/usr/local/lib/node_modules/n8n/node_modules/posthog-node/lib/index.cjs.js:740:16)
    at PostHog.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/posthog-node/lib/index.cjs.js:1129:51)
    at step (/usr/local/lib/node_modules/n8n/node_modules/posthog-node/lib/index.cjs.js:135:27)
    at Object.throw (/usr/local/lib/node_modules/n8n/node_modules/posthog-node/lib/index.cjs.js:84:53)
    at rejected (/usr/local/lib/node_modules/n8n/node_modules/posthog-node/lib/index.cjs.js:71:36) {
  error: DOMException [TimeoutError]: The operation was aborted due to timeout
      at node:internal/deps/undici/undici:13185:13,
  [cause]: DOMException [TimeoutError]: The operation was aborted due to timeout
      at node:internal/deps/undici/undici:13185:13
}
2024-12-04T09:03:19.450Z [Rudder] error: Response error code: ECONNABORTED
2024-12-04T09:03:19.558Z [Rudder] error: Error: ECONNABORTED
timeout of 38502.28686961433ms exceeded
AxiosError: timeout of 38502.28686961433ms exceeded
    at RedirectableRequest.handleRequestTimeout (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:657:16)
    at RedirectableRequest.emit (node:events:519:28)
    at RedirectableRequest.emit (node:domain:488:12)
    at Timeout.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/follow-redirects/index.js:221:12)
    at listOnTimeout (node:internal/timers:581:17)
    at processTimers (node:internal/timers:519:7)
    at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/Axios.js:45:41)
    at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/Axios.js:40:14)
    at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/Axios.js:40:14)
    at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/Axios.js:45:41)
    at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/Axios.js:40:14)
    at Axios.request (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/Axios.js:45:41)

I’m wondering if there are any settings I might have overlooked? Could anyone suggest reasons why this might be failing or offer any insights? Any suggestions or checks I should perform would be highly appreciated.

Thank you!

Information on your n8n setup

  • n8n version: 1.70.1
  • Database (default: SQLite): postgresql
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): k8s
  • Operating system: ubuntu

Does the internal network have access to make http requests to external APIs? oauth callback requires talking to the oauth server to exchange the callback code for an access_token.
The timeout errors suggest that these external requests are being blocked.

2 Likes

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