N8N self hosted websocket connection issue

Describe the problem/error/question

I have a self hosted version of n8n with a custom domain. After taking latest n8n update using docker compose pull I’m facing a issue with websocket connection.

What is the error message (if any)?

[WebSocketClient] Connection lost, code=1008


When I do an inspect of the n8n instance for logs, I get this:

Information on your n8n setup

  • n8n version: latest (1.97.0)
  • Database (default: SQLite): default databse
  • n8n EXECUTIONS_PROCESS setting (default: own, main): unsure
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker compose
  • Operating system: ubuntu

Docker compose yml file:

services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - traefik_data:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: always
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
      - traefik.http.routers.n8n.middlewares=n8n@docker
    environment:
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - N8N_DIAGNOSTICS_ENABLED=${N8N_DIAGNOSTICS_ENABLED}
    volumes:
      - n8n_data:/home/node/.n8n
      - ./local-files:/files

volumes:
  n8n_data:
  traefik_data:

I’ve set the DOMAIN_NAME & SUBDOMAIN properly. It wasn’t an issue before, started happening after the upgrade. Have tried incognito & a different computer also, same issue.

Kindly share some suggestions, help or thoughts. Appreciate it! :folded_hands:

Video of the issue:
Screen Recording 2025-06-03 at 12.28.58

we all have this issue. Seen a post where they are saying to update to 1.97 , but i don’t see anything new when hitting “docker compose pull”

You have to do manually in docker compose
change this : image: n8nio/n8n:latest
to this: image: n8nio/n8n:1.97.0 or 1.94.1 is working

They have fixed also in latest so with docker compose pull should work now.

1.95.3

Can confirm, it works now with latest docker compose pull

1 Like

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