Describe the problem/error/question
I’m new to n8n and I have been using WSL for coding under my Windows system for quite a while. My problem started when I decided to use the containerized version of n8n running on WSL together with a PostgreSQL database that runs in my host system (Windows).
It seems like the container is not able to connect to the database and fails to initialize, even though I can successfully test the connection directly from the WSL terminal.
What is the error message (if any)?
This is the error message with the -e DEBUG=*
option in Docker:
(node:8) Warning: TypeError
module: @oclif/[email protected]
task: findCommand (user-management:reset)
plugin: n8n
root: /usr/local/lib/node_modules/n8n
message: Cannot read properties of undefined (reading ‘database’)
See more details with DEBUG=*
2024-10-30T11:22:34.381Z oclif:config reading user plugins pjson /home/node/.local/share/n8n/package.json
2024-10-30T11:22:34.382Z oclif:config config done
2024-10-30T11:22:34.382Z oclif:config start init hook
2024-10-30T11:22:34.383Z oclif:config init hook done
2024-10-30T11:22:34.383Z oclif:config runCommand start
2024-10-30T11:22:34.383Z oclif:config start command_not_found hook
2024-10-30T11:22:34.383Z oclif:config command_not_found hook done
› Error: command start not found
2024-10-30T11:22:34.387Z oclif:error Error: command start not found
at Config.runCommand (/usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/config/config.js:394:19)
at run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/main.js:94:16)
at /usr/local/lib/node_modules/n8n/bin/n8n:72:2
This is only the final part of the full error, however the following lines are consistent through all of the error message (they appear many times):
(node:8) Warning: TypeError
module: @oclif/[email protected]
and
message: Cannot read properties of undefined (reading ‘database’)
Please share your workflow
I’m using the following environment variables:
N8N_ENCRYPTION_KEY=
DB_TYPE=‘postgresdb’
DB_POSTGRESDB_HOST=‘localhost’
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_DATABASE=‘n8n’
DB_POSTGRESDB_USER=‘postgres’
DB_POSTGRESDB_PASSWORD=‘postgres’
N8N_BASIC_AUTH_ACTIVE=‘true’
N8N_BASIC_AUTH_USER=
N8N_BASIC_AUTH_PASSWORD=
WEBHOOK_URL=
And I’m running the following run script:
sudo docker run --rm --name n8n -p 5678:5678 --env-file n8n.env -v n8n_data:/home/node/.n8n n8nio/n8n:latest
I’ve already changed the configuration of PostgreSQL to listen to any IP and tried using the host.docker.internal host mapped to the WSL IP address, both with no success. The network in WSL is also configured in mirrored mode.
The container runs normally with any of the above mentioned variables except the DB_TYPE, once I define it’s a PostgreSQL database it breaks.
Information on your n8n setup
- **n8n version:**latest
- **Database (default: SQLite):**PostgreSQL 16
- **Running n8n via (Docker, npm, n8n cloud, desktop app):**Docker
- **Operating system:**PostgreSQL server running on Windows 11 23H2 and Docker running on WSL2 with Ubuntu 22.04