Describe the problem/error/question
I randomly get this Service Unavailable error.
When it happens, the following messages appear:
timeout exceeded when trying to connect
Error while saving insights metadata and raw data
Error in handling webhook request POST /webhook/befc7a55-9228-444c-a2e3-5ab24e5954d6: timeout exceeded when trying to connect
What could be done to mitigate that?
I Have about 30K workflow runs a day, I have already verified that the server is enough.
Dedicated: 4 core, 16 GB Ram, 400 GB NVME Hetzner.
I have set haproxy as a load balancer and distributed the load using the 3 webhook instances.
What is the error message (if any)?
Service unavailable - try again later or consider setting this node to retry automatically (in the node settings)
Please share your workflow
Im unable to share the workflow, the 32k char limit.
Share the output returned by the last node
Error details
Other info
n8n version
1.108.2 (Self Hosted)
Time
02/09/2025, 12:52:04
Information on your n8n setup
- n8n version: 1.108.2
- Database (default: SQLite): Postgres + PgBouncer
- n8n EXECUTIONS_PROCESS setting (default: own, main): Main
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker Compose
- Operating system: Debian 13
- Mode: Queue
- Workers: 3
- Webhook Workers: 3
- Reverse Proxy: HAProxy
DOCKER COMPOSE
services:
postgres:
image: postgres:16.10
env_file: db.env
command: >
postgres
-c max_connections=100
-c shared_buffers=2GB
-c effective_cache_size=6GB
-c maintenance_work_mem=1GB
-c work_mem=64MB
-c wal_level=replica
-c wal_compression=on
-c synchronous_commit=off
-c checkpoint_timeout=15min
-c max_wal_size=8GB
-c autovacuum_naptime=10s
-c autovacuum_vacuum_scale_factor=0.1
-c autovacuum_analyze_scale_factor=0.05
volumes:
- n8n_pg_data:/var/lib/postgresql/data
restart: unless-stopped
pgbouncer:
image: edoburu/pgbouncer:latest
env_file: db.env
restart: unless-stopped
volumes:
- ./pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
- ./userlist.txt:/etc/pgbouncer/userlist.txt:ro
valkey:
image: valkey/valkey:latest
restart: unless-stopped
main:
image: n8nio/n8n:latest
env_file: n8n.env
restart: unless-stopped
ports:
- "5678:5678"
volumes:
- ./local-files:/files
worker:
image: n8nio/n8n:latest
env_file: n8n.env
command: worker
restart: unless-stopped
webhook-1:
image: n8nio/n8n:latest
env_file: n8n.env
command: webhook
ports:
- "5679:5678"
restart: unless-stopped
webhook-2:
image: n8nio/n8n:latest
env_file: n8n.env
command: webhook
ports:
- "5680:5678"
restart: unless-stopped
webhook-3:
image: n8nio/n8n:latest
env_file: n8n.env
command: webhook
ports:
- "5681:5678"
restart: unless-stopped
volumes:
n8n_pg_data:
DB ENV:
## POSTGRES
POSTGRES_DB=n8n
POSTGRES_USER=xxxxxxxxxxxxxxx
POSTGRES_PASSWORD=xxxxxxxxxxxxxxx
## PG_BOUNCER
PGBOUNCER_DB=n8n
PGBOUNCER_USER=xxxxxxxxxxxxxxx
PGBOUNCER_PASSWORD=xxxxxxxxxxxxxxx
PGBOUNCER_PORT=6432
PGBOUNCER_POOL_MODE=transaction
PGBOUNCER_DEFAULT_POOL_SIZE=50
PGBOUNCER_MIN_POOL_SIZE=10
PGBOUNCER_RESERVE_POOL_SIZE=10
PGBOUNCER_RESERVE_POOL_TIMEOUT=5
MAIN ENV:
### N8N
## DB
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=pgbouncer
DB_POSTGRESDB_PORT=6432
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_USER=xxxxxxxxxxxxxxxxxxxx
DB_POSTGRESDB_PASSWORD=xxxxxxxxxxxxxxxxxxx
## REDIS
QUEUE_BULL_REDIS_HOST=valkey
QUEUE_BULL_REDIS_PORT=6379
## N8N CONFIGS
N8N_ENCRYPTION_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxx
EXECUTIONS_MODE=queue
## Worker configs
N8N_CONCURRENCY=10
N8N_DISABLE_PRODUCTION_MAIN_PROCESS=true
## EXTRAS
WEBHOOK_URL=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
N8N_RUNNERS_ENABLED=false
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
N8N_PROXY_HOPS=1
EXECUTIONS_DATA_MAX_AGE=720
EXECUTIONS_DATA_PRUNE_MAX_COUNT=10000000
WORKER AND WEBHOOK ENV:
# === Webhook Worker (command: webhook) ===
## DB
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=pgbouncer
DB_POSTGRESDB_PORT=6432
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_USER=xxxxxxxxxxxxxxxxx
DB_POSTGRESDB_PASSWORD=xxxxxxxxxxxx
## REDIS
QUEUE_BULL_REDIS_HOST=valkey
QUEUE_BULL_REDIS_PORT=6379
## N8N (fila + criptografia)
EXECUTIONS_MODE=queue
N8N_ENCRYPTION_KEY=xxxxxxxxxxxxxxxxxx
## WORKER SPECIFIC
N8N_DISABLE_PRODUCTION_MAIN_PROCESS=true
WEBHOOK_URL=xxxxxxxxxxxxxxxxxx

