AWS RDS connecting issue with POSTGRESQL database

Describe the problem/error/question

I am trying to connect to the rds postgresql using a simple docker-compose file. but it is always saying in the log

UserSettings were generated and saved to: /home/node/.n8n/config
2023-08-13T12:13:48.897Z | debug    | Lazy Loading credentials and nodes from n8n-nodes-base "{\n  credentials: 320,\n  nodes: 431,\n  file: 'DirectoryLoader.js',\n  function: 'loadAll'\n}"
2023-08-13T12:16:05.497Z | error    | Last session crashed "{ file: 'CrashJournal.js', function: 'init' }"
2023-08-13T12:16:15.869Z | debug    | Lazy Loading credentials and nodes from n8n-nodes-base "{\n  credentials: 320,\n  nodes: 431,\n  file: 'DirectoryLoader.js',\n  function: 'loadAll'\n}"

Please share your workflow

my docker-compose file is running in an ec2 instance. both rds and ec2 are running in the same VPC. My compose file:

version: '3.8'

services:
  n8n:
    image: n8nio/n8n:latest
    restart: unless-stopped
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=host_name
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=db_name
      - DB_POSTGRESDB_USER=user
      - DB_POSTGRESDB_PASSWORD=some_pass
      - N8N_LOG_LEVEL=debug
      - DB_LOGGING_OPTIONS=all
      - DB_LOGGING_ENABLED=true
    ports:
      - 80:5678

Information on your n8n setup

  • latest
  • PostgreSQL v11.9
  • Docker
  • ubuntu

Hey @Mohammad_Raisul_isla,

Welcome to the community :cake:

I suspect this is an issue with the database connection, Possibly with the SSL/TLS settings. Can you set N8N_DIAGNOSTICS_ENABLED=false in your compose file and start n8n then check the output to see if there is any other error messages.

hi @Jon ,

thanks for the warm welcome.
I added the variable. Sharing the log :slight_smile:

n8n_1  | UserSettings were generated and saved to: /home/node/.n8n/config
n8n_1  | 2023-08-14T15:20:59.819Z | debug    | Lazy Loading credentials and nodes from n8n-nodes-base "{\n  credentials: 320,\n  nodes: 431,\n  file: 'DirectoryLoader.js',\n  function: 'loadAll'\n}"
n8n_1  | 2023-08-14T15:23:10.017Z | error    | Error: There was an error initializing DB "{ file: 'ErrorReporterProxy.js', function: 'report' }"
n8n_1  | 2023-08-14T15:23:10.018Z | error    | Error: connect ETIMEDOUT 172.31.41.74:5432 "{ file: 'ErrorReporterProxy.js', function: 'report' }"

Hey @Mohammad_Raisul_isla,

It looks like it is a networking issue and the n8n instance can’t talk to the database.

connect ETIMEDOUT 172.31.41.74:5432

I am not that familiar with AWS RDS but it looks like you may need to open a port or allow the communication somewhere in it.

1 Like

thanks worked, my bad

2 Likes

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