I haven’t used n8n myself, but it seems there are several common issues.
Root cause: n8n can’t connect to Postgres. The line “Tenant or user not found” is emitted by Supabase’s pooler when the username or port is wrong. n8n then fails at DB init and your Space crashes. Supabase’s docs and GitHub discussions confirm the pooled port 6543 and username format postgres.<PROJECT_REF>. Dates: docs updated 2025-09-09; discussion 2024-10-25; discussion 2025-05-18. (Supabase)
Fix by cause
1) Supabase pooler creds wrong → set correct host/port/user
- Use the pooled host
*.pooler.supabase.com and port 6543.
- Username must include the project ref:
postgres.<project_ref>.
- Copy from Supabase “Connect” page. Transaction mode uses 6543. Session mode uses 5432. (Supabase)
Space variables (Hugging Face → Settings → Secrets/Variables), then restart:
# n8n ? Supabase pooler (transaction mode)
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=aws-0-<region>.pooler.supabase.com
DB_POSTGRESDB_PORT=6543
DB_POSTGRESDB_DATABASE=postgres
DB_POSTGRESDB_USER=postgres.<PROJECT_REF>
DB_POSTGRESDB_PASSWORD=<password>
DB_POSTGRESDB_SCHEMA=public
# refs:
# https://supabase.com/docs/guides/database/connecting-to-postgres (ports)
# https://supabase.com/docs/guides/troubleshooting/how-do-i-update-connection-pool-settings-in-my-dashboard-wAxTJ_ (username format)
(Supabase)
Why this matters. Supabase identifies your DB at the pooler by username + ref. Wrong user or port triggers exactly “Tenant or user not found.” Multiple reports mirror your log. (GitHub)
2) n8n DB env missing/mis-set → declare full Postgres block
n8n defaults to SQLite. For Postgres you must set DB_TYPE=postgresdb + all DB_POSTGRESDB_* keys. Official docs list every variable and defaults. (n8n Docs)
# Minimal Postgres config for n8n
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=<host>
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_DATABASE=<db>
DB_POSTGRESDB_USER=<user>
DB_POSTGRESDB_PASSWORD=<pass>
DB_POSTGRESDB_SCHEMA=public
# https://docs.n8n.io/hosting/configuration/supported-databases-settings/
(n8n Docs)
3) SSL required by your Postgres → add TLS settings
Some managed Postgres instances require TLS. n8n supports CA/cert/key and the reject flag. If you see SSL errors, mount a CA and enable TLS. (n8n Docs)
DB_POSTGRESDB_SSL_ENABLED=true
DB_POSTGRESDB_SSL_CA=/files/root-ca.pem
# only if needed for self-signed chains:
DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED=false
# https://docs.n8n.io/hosting/configuration/environment-variables/database/
(n8n Docs)
4) You actually ran SQLite → install driver or use official image
If DB_TYPE is unset and your image lacks sqlite3, n8n logs “SQLite package has not been found installed” and exits. Either install the driver or use the official n8nio/n8n image. Community threads show the same loop. (n8n Community)
5) Space misconfiguration/cache → secrets, rebuild, factory reboot
Set DB creds as Secrets or Variables. A change triggers a restart. If a stale build persists, run a Factory reboot from Space settings to rebuild clean. (Hugging Face)
Quick diagnostic loop
- Open Supabase → Connect. Confirm pooled string uses
...pooler...:6543 and postgres.<project_ref>. (Supabase)
- In your Space, set the env block from section 1. Restart.
- If still failing, try the session pooler once as a sanity check (
:5432 with the same postgres.<project_ref>). If 5432 works but 6543 doesn’t, the transaction pool config is off. (Supabase)
- If your Postgres enforces TLS, add the SSL vars. (n8n Docs)
- If you intended SQLite, switch to the official n8n image or install
sqlite3. (n8n Community)
Space-ready example (Supabase, transaction pool)
# Set in HF Space → Settings
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=aws-0-ap-northeast-1.pooler.supabase.com
DB_POSTGRESDB_PORT=6543
DB_POSTGRESDB_DATABASE=postgres
DB_POSTGRESDB_USER=postgres.<PROJECT_REF>
DB_POSTGRESDB_PASSWORD=<pwd>
DB_POSTGRESDB_SCHEMA=public
N8N_ENCRYPTION_KEY=<32+ random chars> # keeps creds usable across restarts
WEBHOOK_URL=https://<your-domain>/
N8N_HOST=<your-domain>
N8N_PROTOCOL=https
# refs:
# https://supabase.com/docs/guides/database/connecting-to-postgres
# https://docs.n8n.io/hosting/configuration/supported-databases-settings/
(Supabase)
Context and background
- Supabase pooler modes and ports: direct 5432, session 5432, transaction 6543. Choosing the wrong port or not appending the project ref to the username yields the “Tenant or user not found” you see. Updated 2025-02-04 and 2025-09-09. (Supabase)
- n8n DB variables and TLS flags are documented and stable; MySQL/MariaDB are deprecated. (n8n Docs)
- HF Spaces exposes Secrets/Variables as env vars; changes restart the app. Factory reboot rebuilds without cache. (Hugging Face)
Short, vetted references
- Supabase: connection modes and pooled username format. 2025-09-09, 2025-02-04. (Supabase)
- Supabase GitHub Discussions: identical error and fixes. 2024-10-25, 2025-05-18. (GitHub)
- n8n docs: Postgres env and SSL variables. current. (n8n Docs)
- HF Spaces: manage secrets/variables and restarts. current; factory reboot noted on forum. (Hugging Face)