n8n 無法連接到同一項目中的 PostgreSQL 服務。我已經嘗試以下配置:
n8n 環境變數設置:
DB_TYPE: postgresdbDB_POSTGRESDB_HOST: postgresql(已嘗試service-687c46f20d798e898924aab9和postgresql)DB_POSTGRESDB_PORT: 5432DB_POSTGRESDB_USER: rootDB_POSTGRESDB_PASSWORD: WDde94Q1lF7T2Uns3Lq0G8hyYm6PHO5uDB_POSTGRESDB_DATABASE: zeaburDB_POSTGRESDB_CONNECTION_TIMEOUT: 120000
PostgreSQL 服務狀態:
- 服務狀態:RUNNING(正常運行)
- 數據庫已成功初始化
日誌錯誤信息
Error: Could not establish database connection within the configured timeout of 120,000 ms. Please ensure the database is configured correctly and the server is reachable.Startup probe failed: Get "http://172.31.40.205:5678/healthz": dial tcp 172.31.40.205:5678: connection refused
已嘗試的解決方案
- ✅ 更新 n8n 的 PostgreSQL 連接環境變數
- ✅ 增加連接超時時間(從 60s 到 120s)
- ✅ 嘗試不同的主機名配置(服務 ID、服務名稱、localhost)
- ✅ 檢查 PostgreSQL 服務日誌(服務正常運行)
需要幫助
請幫助診斷為什麼 n8n 無法通過服務名稱連接到 PostgreSQL。這可能是 Zeabur 內部網路配置或服務間通信的問題。