Having trouble during RDS Postgres Connectivity

Describe the problem/error/question

Unable to connect RDS POSTGRES from n8n container for internal data use the typical command i use for this , surprisingly from the same machine i’m able to connect through psql client with same values

docker run -d --name n8n-test --restart always --network host -e DB_TYPE=postgresdb -e DB_POSTGRESDB_HOST= -e DB_POSTGRESDB_PORT=5432 -e DB_POSTGRESDB_DATABASE= -e DB_POSTGRESDB_USER= -e DB_POSTGRESDB_PASSWORD= -p 5678:5678 -v n8n_storage_dev:/home/node/.n8n docker.io/n8nio/n8n

What is the error message (if any)?

User settings loaded from: /home/node/.n8n/config
Last session crashed
Initializing n8n process
There was an error initializing DB
no pg_hba.conf entry for host “10.x.x.x”, user “n8n_db_user”, database “dev_n8n_db”, no encryption

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: Version 1.79.3
  • Database (default: SQLite): RDS POSTGRES
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: linux

I just wrote a lengthy post about docker compose + networks and just noticed the error message at the end of your post:

no pg_hba.conf entry for host “10.x.x.x”, user “n8n_db_user”, database “dev_n8n_db”, no encryption

usually the postgresql docker has set up a propper pg_hba.conf to allow connections.
Is this a postgresql that’s not in docker? If so edit the pg_hba.conf

/var/lib/postgresql/*/main/pg_hba.conf

and add a setting for your IP Address

host all all 10.x.x.x/32 <METHOD>

Please note that the at the end should be the method, I did not want to leave the old Example I had from an old postgres 13 laying around, you can read about that here:

@crisl

Like i said, i’m able to access the db from the same host, infact i’ve set the network to host while creating the container.

Hi @Ravindra_Sai

have a look here, adding the env option mentioned in this topic solved it for me with RDS.