The "SUBDOMAIN" variable is not set

Hi together,

after getting mail to work i get the “Forget Password” Mail. There is a link in the Mail, when clicking on it, it will send me to https://localhost:5678… which could not work.

I’ve read that there some environment variables must also set. I’ve tried to achieve this …

services:
  n8n:
    image: n8nio/n8n:latest
    ports:
      - "5678:5678"
    restart: always
    environment:
      - DOMAIN_NAME=mydomain.de
      - SUBDOMAIN=n8n
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=0987654321
      - GENERIC_TIMEZONE=Europe/Berlin
      - N8N_SECURE_COOKIE=false
      - N8N_EMAIL_MODE=smtp
      - N8N_SMTP_HOST=smtp.strato.de
      - N8N_SMTP_PORT=465
      - [email protected]
      - N8N_SMTP_PASS=1234567890
      - [email protected]
      - N8N_SMTP_SSL=true
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
    volumes:
      - n8n_data:/home/node/.n8n
    depends_on:
      - postgres
  postgres:
    image: postgres:14
    restart: always
    environment:
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=0987654321
      - POSTGRES_DB=n8n
    volumes:
      - postgres_data:/var/lib/postgresql/data
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '443:443'
      - '81:81'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
volumes:
  n8n_data:
  postgres_data:

But when i try to start up docker, then there’s stated that the variable is not set:

user@linux:~/n8n-produktiv$ sudo docker compose up -d
[sudo] Passwort für user:
WARN[0000] The "SUBDOMAIN" variable is not set. Defaulting to a blank string.
WARN[0000] The "DOMAIN_NAME" variable is not set. Defaulting to a blank string.
WARN[0000] The "SUBDOMAIN" variable is not set. Defaulting to a blank string.
WARN[0000] The "DOMAIN_NAME" variable is not set. Defaulting to a blank string.
[+] Running 3/3
 ✔ Container n8n-produktiv-postgres-1  Running                                                                                                                                                0.0s
 ✔ Container n8n-produktiv-app-1       Running                                                                                                                                                0.0s
 ✔ Container n8n-produktiv-n8n-1       Running                                                                                                                                                0.0s
user@linux:~/n8n-produktiv$ ^C

But I’ve the domian name and subdomain in docker-compose.yml. Where’s my fault? Cant understand why it’s not using it.

Hey, looks like you need to set the proper webhook URL for the password reset emails. Try setting these environment variables directly:

environment:
  - N8N_HOST=n8n.mydomain.de
  - WEBHOOK_URL=https://n8n.mydomain.de

This tells n8n what URL to use in emails instead of defaulting to localhost:5678. Just replace n8n.mydomain.de with your actual domain.

Ahhh, ok. Then i’ll make it like this. I asked me before (because i fond those new lines …

      - DOMAIN_NAME=mydomain.de
      - SUBDOMAIN=n8n
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/

… from another forum post … is it really neccessary to make it like this, and then build the real url from variables, or … is it not really also possible to just write mydomain directly in the config, without hocus pocus.

I’vd decided to delete those lines from my config and make it just with the 2 lines, you described. And i wold thought, this must work.

I thought, this must be set up in that way, to keep flexibility and so on.

But unfortunately after modify the config, no more SMTP Mails are working …

image

I can’t figure out, where should now be the problem in the config:

services:
  n8n:
    image: n8nio/n8n:latest
    ports:
      - "5678:5678"
    restart: always
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=1234567890
      - GENERIC_TIMEZONE=Europe/Berlin
      - N8N_EMAIL_MODE=smtp
      - N8N_SMTP_HOST=smtp.strato.de
      - N8N_SMTP_PORT=465
      - [email protected]
      - N8N_SMTP_PASS=0987654321
      - [email protected]
      - N8N_SMTP_SSL=true
      - N8N_HOST=n8n.mydomain.de
      - WEBHOOK_URL=n8n.mydomain.de/
    volumes:
      - n8n_data:/home/node/.n8n
    depends_on:
      - postgres
  postgres:
    image: postgres:14
    restart: always
    environment:
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=1234567890
      - POSTGRES_DB=n8n
    volumes:
      - postgres_data:/var/lib/postgresql/data
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '443:443'
      - '81:81'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
volumes:
  n8n_data:
  postgres_data:

Is there a way to look, which line or what exactly in the config, is not correct?!

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