Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres node with ssh tunnel - random Connection refused #12807

Open
andrsp opened this issue Jan 23, 2025 · 1 comment
Open

Postgres node with ssh tunnel - random Connection refused #12807

andrsp opened this issue Jan 23, 2025 · 1 comment
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@andrsp
Copy link

andrsp commented Jan 23, 2025

Bug Description

I'm using postgres node in workflows with option to connect via ssh tunnel.
After upgrading from 1.73 to 1.75.2 (and 1.76.0) some of workflow executions started failing on postgres node with error which looks like this:

Connection refused
127.0.0.1:44563

looks like ssh tunnel closed after some time (5m?) and reconnecting not working as expected

error log from node:

Node type: n8n-nodes-base.postgres
Node version: 2.5 (Latest)
n8n version: 1.76.0 (Self Hosted)

Stack trace

NodeOperationError: Connection refused
 at parsePostgresError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_@aws-sdk+credential-provi_itzq4gjm3572fjrrbfktkg2f4u/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/helpers/utils.js:102:12)
 at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_@aws-sdk+credential-provi_itzq4gjm3572fjrrbfktkg2f4u/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/helpers/utils.js:205:31
 at processTicksAndRejections (node:internal/process/task_queues:95:5)
 at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_@aws-sdk+credential-provi_itzq4gjm3572fjrrbfktkg2f4u/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/actions/database/select.operation.js:85:12)
 at ExecuteContext.router (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_@aws-sdk+credential-provi_itzq4gjm3572fjrrbfktkg2f4u/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/actions/router.js:59:26)
 at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_@aws-sdk+credential-provi_itzq4gjm3572fjrrbfktkg2f4u/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/PostgresV2.node.js:16:16)
 at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected]_/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:632:19)
 at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected]_/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:890:51
 at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected]_/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:1224:20

switching to direct connection to postgres without tunnel fixes problem

To Reproduce

  1. set up postgres credentials with ssh tunnel
  2. set up workflow with postgres node using these credentials
  3. execute flow continuously for 5-10 minutes
  4. after ~5min you will start see errors

Expected behavior

postgres node works same way with or without ssh tunnel

Operating System

ubuntu 22.04 / docker

n8n Version

1.76

Node.js Version

2.5

Database

PostgreSQL

Execution mode

queue

@Joffcom
Copy link
Member

Joffcom commented Jan 23, 2025

Hey @andrsp,

We have created an internal ticket to look into this which we will be tracking as "N8N-8213"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants