Unable to connect Postgres DB with n8n

This does indeed sound like an issue with using the tunnel option. With ssh tunnel enabled the code creates a TCP proxy on the local postgres port, which becomes an issue when there are concurrent postgres node executions.
I’ll try to get a fix out next week.

Hello!

Yep, also using the tunnel

Hello, may I ask if there is any update here?

Hey @Fernand,

Yes, the below should fix this and it will be available in this weeks release.

Awesome! Thanks a lot for taking care!

New version [email protected] got released which includes the GitHub PR 9906.

Hello,

I still have the following issue:

n8n version 1.50.0 (Cloud)

Error: All configured authentication methods failed at doNextAuth (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/client.js:865:21) at tryNextAuth (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/client.js:1082:7) at USERAUTH_FAILURE (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/client.js:430:11) at 51 (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/handlers.misc.js:408:16) at Protocol.onPayload (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/Protocol.js:2059:10) at AESGCMDecipherNative.decrypt (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/crypto.js:987:26) at Protocol.parsePacket [as _parse] (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/Protocol.js:2028:25) at Protocol.parse (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/Protocol.js:313:16) at Socket.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/client.js:775:21) at Socket.emit (node:events:519:28) at Socket.emit (node:domain:488:12) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Socket.Readable.push (node:internal/streams/readable:390:5) at TCP.onStreamRead (node:internal/stream_base_commons:191:23) at TCP.callbackTrampoline (node:internal/async_hooks:130:17)

This would imply that the SSH auth is wrong. Can you use the same SSH credentials with an SSH or SFTP node?

I got myself whitelisted to our Bastion server and could properly connect; I used the same credentials, user, and key on n8n and have the issue; I also whitelist those IPs: Cloud IP addresses | n8n Docs but still have an issue to connect.

What I meant was: Have you tried using the same credentials on a SSH node in n8n. If the same key works for SSH node, but not for postgres tunnels. then we have a bug that needs to be investigated.

I created a “ssh command” where I used the same credentials/ip and I could connect and execute a basic “ls -la” command.

@netroy Hi, now I can’t connect anymore to the database via ssh. My old and new database credentials throw the error “Couldn’t connect with these settings
Connection refused”. I am using Privatekey/Passphrase and I turned on “Ignore SSL Issues”

The n8n SSH credentials are working fine though.

I am using N8N Cloud 1.50.1.

@Fernand do you also have the “Ignore SSL Issues” flag enabled?

Can you folks share a screenshot of your postgres crendentials? That might help see any common patterns here.

I think I figured out the issue. Can you folks please try using the docker image n8nio/n8n:fix-ssh-tunnel to see if this fixes the issue for you?

Hi, thanks this version works again!

1 Like

Thanks for confirming. We’ll get this merged tomorrow, and then create a new patch release.

New version [email protected] got released which includes the GitHub PR 10148.

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