AWS RDS Postgres 15

n8n process would not start

Pointing n8n to AWS RDS postgresql 15 makes it not start.
Pointing it to AWS RDS Postgresql 14 is working fine.
The database fro 15 is a dump/restore from 14, nothing should be different.
Changed the log level to debug in the hope I am seeing somethign useful…

What is the error message (if any)?

{"level":"debug","message":"Lazy Loading credentials and nodes from n8n-nodes-base","metadata":{"credentials":316,"file":"DirectoryLoader.js","function":"loadAll","nodes":416,"timestamp":"2023-05-29T11:23:36.853Z"}}
{"level":"debug","message":"No codex available for: RedisStreamsTrigger.node.js","metadata":{"file":"DirectoryLoader.js","function":"addCodex","timestamp":"2023-05-29T11:23:37.266Z"}}
{"level":"warn","message":"License manager not initialized","metadata":{"file":"License.js","function":"isFeatureEnabled","timestamp":"2023-05-29T11:23:44.769Z"}}

Information on your n8n setup

  • n8n version: 0.227.1 and then tried 0.230.1 as well
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default for the official docker image
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker, official docker image (on hub.docker.com)
  • Operating system: Linux

Hi @Serban_Teodorescu, welcome to the community.

I am sorry to hear you’re having trouble. I quickly gave the below docker compose set up a go, but could start n8n just fine against PostgreSQL v15:

services:
  postgres:
    image: postgres:15
    restart: unless-stopped
    environment:
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=n8n
      - POSTGRES_DB=n8n
    volumes:
      - ./db_data:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -h localhost -U n8n -d n8n']
      interval: 5s
      timeout: 5s
      retries: 10
  n8n:
    image: n8nio/n8n:latest
    restart: unless-stopped
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=n8n
    ports:
      - 5678:5678
    volumes:
      - ./n8n_data:/home/node/.n8n
    depends_on:
      postgres:
        condition: service_healthy

There were no db-related errors:

Perhaps this is related to the network on your end? Possibly a firewall quietly dropping all n8n attempts to connect to your database or something along these lines?

There are no network related issues.
I am running n8n as container in docker. On the same EC2 instance there are other containers talking happily with postgres 15.
Also not an issue of user/password or permissions.
Also worth mentioning that it looks like the official postgres 15 docker image is working just fine.
It’s the AWS RDS Postgres 15 that does not work.

What is most annoying is that I get no error message whatsoever so I can’t even attempt to find a solution.

I suspect there is an issue with the connection or the credentials but if you set DEBUG=*, N8N_LOG_LEVEL=debug, DB_LOGGING_ENABLED=true and DB_LOGGING_OPTIONS=all this should then produce a lot of extra logging that might show more information.

I have the same problem when trying to setup a new n8n instance with AWS RDS Postgresql 15.3.

This is the log:

n8n_1        | 2023-06-06T15:13:49.132Z | warn     | License manager not initialized "{ file: 'License.js', function: 'isFeatureEnabled' }"
n8n_1        | 2023-06-06T15:13:49.135Z | error    | Last session crashed "{ file: 'CrashJournal.js', function: 'init' }"
n8n_1        | 2023-06-06T15:13:59.503Z | debug    | Lazy Loading credentials and nodes from n8n-nodes-base "{\n  credentials: 316,\n  nodes: 416,\n  file: 'DirectoryLoader.js',\n  function: 'loadAll'\n}"

I can connect from the EC2 instance to the database with psql

psql -h $RDS_ENDPOINT -p 5432 -U $RDS_USER -l

gives the following response


                                        List of databases
          Name          |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
------------------------+----------+----------+-------------+-------------+-----------------------
 postgres               | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 rdsadmin               | rdsadmin | UTF8     | en_US.UTF-8 | en_US.UTF-8 | rdsadmin=CTc/rdsadmin+
                        |          |          |             |             | rdstopmgr=Tc/rdsadmin
 n8ndatabase_postgresql | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0              | rdsadmin | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/rdsadmin          +
                        |          |          |             |             | rdsadmin=CTc/rdsadmin
 template1              | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
                        |          |          |             |             | postgres=CTc/postgres
(5 rows)

Hey @Areip,

Can you try with the extra config options I provided above?

Hey Jon,
Thank you for your response.
I did tried with the extra config options.
I am getting more messages indeed, but nothing of use.
Please find below the stdout of the docker container (the log files show the same content as before).
I did stripped the multitude of “express:router” lines.

n8n_1          | 2023-06-08T05:50:48.094Z @oclif/config reading core plugin /usr/local/lib/node_modules/n8n
n8n_1          | 2023-06-08T05:50:48.096Z @oclif/config loadJSON /usr/local/lib/node_modules/n8n/package.json
n8n_1          | 2023-06-08T05:50:48.100Z @oclif/config loadJSON /usr/local/lib/node_modules/n8n/oclif.manifest.json
n8n_1          | 2023-06-08T05:50:48.102Z @oclif/config:n8n using manifest from /usr/local/lib/node_modules/n8n/oclif.manifest.json
n8n_1          | 2023-06-08T05:50:48.103Z @oclif/config reading user plugins pjson /home/node/.local/share/n8n/package.json
n8n_1          | 2023-06-08T05:50:48.104Z @oclif/config loadJSON /home/node/.local/share/n8n/package.json
n8n_1          | 2023-06-08T05:50:48.104Z @oclif/config config done
n8n_1          | 2023-06-08T05:50:48.104Z @oclif/config start init hook
n8n_1          | 2023-06-08T05:50:48.105Z @oclif/config init hook done
n8n_1          | 2023-06-08T05:50:48.107Z n8n init version: @oclif/[email protected] argv: [ 'start' ]
n8n_1          | 2023-06-08T05:50:48.110Z @oclif/config runCommand start []
n8n_1          | 2023-06-08T05:50:48.110Z @oclif/config:n8n require /usr/local/lib/node_modules/n8n/dist/commands/start.js
n8n_1          | 2023-06-08T05:50:51.240Z @oclif/config start prerun hook
n8n_1          | 2023-06-08T05:50:51.240Z @oclif/config prerun hook done
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "x-powered-by" to true
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "etag" to 'weak'
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "etag fn" to [Function: generateETag]
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "env" to 'production'
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "query parser" to 'extended'
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "query parser fn" to [Function: parseExtendedQueryString]
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "subdomain offset" to 2
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "trust proxy" to false
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "trust proxy fn" to [Function: trustNone]
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application booting in production mode
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "view" to [Function: View]
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "views" to '/data/views'
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "jsonp callback name" to 'callback'
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "view cache" to true
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "x-powered-by" to false
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "view engine" to 'handlebars'
n8n_1          | Thu, 08 Jun 2023 05:50:51 GMT express:application set "views" to '/usr/local/lib/node_modules/n8n/templates'

That is odd I was expecting a lot more :thinking: Try setting DEBUG= to clear that and just have the other 3 enabled. For science if you could use an incorrect host for the database it will let us see if it logs that correctly.

1 Like

I I am setting DEBUG- then it kinda goes back to the old behaviour, not showing anything

APP_ENV=dev
APP_SECRET=some-app-secret
DB_LOGGING_ENABLED=true
DB_LOGGING_OPTIONS=all
DB_POSTGRESDB_DATABASE=some_n8n
DB_POSTGRESDB_HOST=dev-postgres-15.xxxxx.us-east-1.rds.amazonaws.com
DB_POSTGRESDB_PASSWORD=password
DB_POSTGRESDB_USER=some_n8n
DB_TYPE=postgresdb
HOME=/root
HOSTNAME=n8n
N8N_CUSTOM_EXTENSIONS=/custom
N8N_DIAGNOSTICS_ENABLED=true
N8N_EMAIL_MODE=smtp
N8N_ENCRYPTION_KEY=some-encryption-string
N8N_LOG_FILE_LOCATION=/var/log/n8n/n8n.log
N8N_LOG_FILE_MAXCOUNT=10
N8N_LOG_FILE_MAXSIZE=10
N8N_LOG_LEVEL=debug
N8N_LOG_OUTPUT=file
N8N_PATH=/n8n/
N8N_PORT=80
N8N_SMTP_HOST=doesnt matter
N8N_SMTP_PORT=25
[email protected]
N8N_SMTP_SSL=false
N8N_VERSION=0.230.1
NODE_ENV=production
NODE_ICU_DATA=/usr/local/lib/node_modules/full-icu
NODE_VERSION=16.20.0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/data
SHLVL=1
TERM=xterm
TZ=Etc/UTC
WEBHOOK_URL=https://the-real-url
YARN_VERSION=1.22.19

will result in

{"level":"warn","message":"License manager not initialized","metadata":{"file":"License.js","function":"isFeatureEnabled","timestamp":"2023-06-12T14:32:40.332Z"}}
{"level":"error","message":"Last session crashed","metadata":{"file":"CrashJournal.js","function":"init","timestamp":"2023-06-12T14:32:40.334Z"}}
{"level":"warn","message":"License manager not initialized","metadata":{"file":"License.js","function":"isFeatureEnabled","timestamp":"2023-06-12T14:32:49.175Z"}}
{"level":"error","message":"Last session crashed","metadata":{"file":"CrashJournal.js","function":"init","timestamp":"2023-06-12T14:32:49.176Z"}}
{"level":"debug","message":"Lazy Loading credentials and nodes from n8n-nodes-base","metadata":{"credentials":316,"file":"DirectoryLoader.js","function":"loadAll","nodes":416,"timestamp":"2023-06-12T14:32:59.8
35Z"}}
{"level":"debug","message":"No codex available for: RedisStreamsTrigger.node.js","metadata":{"file":"DirectoryLoader.js","function":"addCodex","timestamp":"2023-06-12T14:33:00.428Z"}}
{"level":"warn","message":"License manager not initialized","metadata":{"file":"License.js","function":"isFeatureEnabled","timestamp":"2023-06-12T14:33:11.308Z"}}
{"level":"error","message":"Last session crashed","metadata":{"file":"CrashJournal.js","function":"init","timestamp":"2023-06-12T14:33:11.310Z"}}
{"level":"debug","message":"Lazy Loading credentials and nodes from n8n-nodes-base","metadata":{"credentials":316,"file":"DirectoryLoader.js","function":"loadAll","nodes":416,"timestamp":"2023-06-12T14:33:21.9
05Z"}}
{"level":"debug","message":"No codex available for: RedisStreamsTrigger.node.js","metadata":{"file":"DirectoryLoader.js","function":"addCodex","timestamp":"2023-06-12T14:33:22.482Z"}}```

Hey @Serban_Teodorescu,

Is it expecting SSL / TLS? It could be that you need to add the certificate option to the connection.

Hey, i was having this issue with Azure Postgres running my n8n on Kubernetes and i solve with the env:

  • name: DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED
    value: “false”

Hope this helps :smiley:

2 Likes

I will try this as well, but please keep in mind n8n is working with AWS RDS postgres 14. It is NOT working with AWS RDS Postgres 15.

I would assume both would use same CA and certificate type so it should fail on both or on none of them.

Hey @Serban_Teodorescu,

I wouldn’t want to assume, They could be using different certs and if that is the case you could add the certs to be trusted using the env options like DB_POSTGRESDB_SSL_CA or DB_POSTGRESDB_SSL_CERT it could be that for 15 AWS is using a different CA which isn’t trusted by our image and that is why the reject unauthorised is working.

1 Like

I faced this problem last night, and using the “traefik” image provided here : Docker Compose | n8n Docs solved the problem.

2 Likes

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