Connection lost: You have a connection issue or the server is down. n8n should reconnect automatically once the issue is resolved

this worked!! love you man, added -e N8N_PUSH_BACKEND=sse in dokcer run

contributing my docker run here for future reference

make volume n8n_data
and make network n8n_network

docker run -d --name n8n --network n8n_network --dns=8.8.8.8 --dns=1.1.1.1 --dns-search=domain.com --e N8N_HOST="subdomain.domain.com" --e WEBHOOK_URL="https://subdomain.domain.com/" --e VUE_APP_URL_BASE_API="https://subdomain.domain.com/" -e NODE_FUNCTION_ALLOW_EXTERNAL="*" -e N8N_PUSH_BACKEND=sse -v n8n_data:/home/node/.n8n -p 5678:5678 n8nio/n8n

just replace subdomain and domain values

1 Like

Folks using NGINX Proxy Manager, all you have to do is to enable Websockets Support.

7 Likes

After apply the N8N_PUSH_BACKEND=see, under the logs I see the following message:

Collaboration features are disabled because push is configured unidirectional. Use N8N_PUSH_BACKEND=websocket environment variable to enable them.
Version: 1.86.1

What does it mean? I have activated the Websockets Support under my proxy manager

1 Like


I enabled the Webhook on my Nginx and it passed through correctly. I did the same process for my API (EvolutionAPI).
That solution worked for me.

I actually got rid of this issue in the past, but now I downloaded the next (1.88) version and the issue is showing itself again. However, I cloned the container that worked (using docker on synology ds923), but I keep getting the Connection lost issue. Anyone else facing that switching from latest to next version?

1 Like

Here’s the YML btw:

version: ‘3.8’

services:
n8n:
image: docker.n8n.io/n8nio/n8n:next
container_name: n8n-next
restart: always
ports:
- “5678:5678”
environment:
- TZ=Europe/Amsterdam
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=MYUSER
- N8N_BASIC_AUTH_PASSWORD=MYPASSWORD
- N8N_PORT=5678
- N8N_HOST=n8n.northernlights.solutions
- N8N_PROTOCOL=https
- N8N_EDITOR_BASE_URL=https://n8n.northernlights.solutions
- WEBHOOK_URL=https://n8n.northernlights.solutions/
- N8N_SKIP_WEBHOOK_DEREGISTRATION_SHUTDOWN=true
- N8N_EXECUTIONS_PROCESS=main
- N8N_RUNNERS_ENABLED=true
- N8N_PUSH_BACKEND=sse
- N8N_SECURE_COOKIE=false
volumes:
- /volume1/NorthernLights Solutions/n8n/data:/home/node/.n8n
- /volume1/NorthernLights Solutions/n8n/files:/files

(this exact config works perfectly on ‘latest’)

I’m getting that error again as well. It just started showing up in the past couple of days. I’m using “sse” as the N8N_PUSH_BACKEND value.

1 Like

Changing nginx config to this fixed my problem, hope it works for you too:

server {
    server_name yourdomain;

    location / {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_buffering off;
        chunked_transfer_encoding off;
        proxy_cache off;
    }
}

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

Also if you use cloudflare, disabling caching for your subdomain is recommended.

2 Likes

Yes I had the same issue when migrating to 1.88. Opened a issue in github: Connection lost when behind a CDN · Issue #14572 · n8n-io/n8n · GitHub

For me the issue was solved switching the SSE to websocket in the N8N_PUSH_BACKEND environment. (and enable proper websocketing settings on my Synology DS923 NAS)

in nginx .conf

/location
add this code

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

in env docker must add N8N_PUSH_BACKEND=websocket

this is my solution for Version: 1.88.0

5 Likes

I got it to work by putting the script hereunder in the nginx manager and changing the manager and N8N_PUSH_BACKEND both to websocket. But after that I got enough of this recurrung problem and with the prompt help of claude.ai I got a YML script for traefik and in no time I eliminated the use of nginx once and for all.

Anyway, this was the solution with nginx:

location /sockjs-node {
proxy_pass https://n8n:5678;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /websocket {
proxy_pass https://n8n:5678;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

Kind regards :slight_smile:

This worked for me: Connection lost after upgrade to 1.88.0 · Issue #14653 · n8n-io/n8n · GitHub

2 Likes

Greetings, everyone:

I had the exact same issue. In my case, since I’m using Nginx Proxy Manager, the solution was to enable the “Websockets Support” option in the proxy host settings.

3 Likes

I have successfully fixed it!
:point_right: “Connection lost” error happens from n8n version 1.79.3 and above.
:point_right: Solution: downgrade to n8n 1.78.1 + fix WebSocket proxy settings in Nginx.
:point_right: Then restart Nginx — the issue will be resolved.

Solution as given is not perse the right one, as reverting to a previous version should not be needed.
As mentioned by multiple people replying here, the issue is that WSS needs to be enabled in the reverse proxy.

Many thanks for your tip :slight_smile:

I’m running 1.90.2 and I had to add this line to the nginx conf file:

proxy_set_header Origin https://$host;

2 Likes

This configuration works for me on 1.90 with N8N_PUSH_BACKEND=websocket and N8N_PROXY_HOPS=1 environment variable

1 Like

Hi, guys.
I upgraded from version 1.78.1 to 1.90.1 and had several problems. To help you out, I’ll share what worked for me:

First, upgrade through the versions.
I went to 1.80.1
in NGINX:
proxy_http_version 1.1; # Required for WebSocket
proxy_set_header Upgrade $http_upgrade; # Required for WebSocket
proxy_set_header Connection “upgrade”; # Required for WebSocket

N8N:
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
N8N_RUNNERS_ENABLED=true
VUE_APP_URL_BASE_API=“https://DOMINIO.COM

Command line used:
docker run -d -it --rm --name n8n -p 5678:5678 -e N8N_RUNNERS_ENABLED=true -e N8N_ENFORCE_SETTINGS_FILE_PERM
ISSIONS=true -e N8N_PUSH_BACKEND=websocket -e N8N_PROXY_HOPS=1 -e VUE_APP_URL_BASE_API=“https://DOMINIO.COM” -e WEBHOOK_URL=https://DOMINIO.COM -v n8n_data:/home/node/.n8n n8nio/n8n:latest

Then upgrade to:
1.90.1

Here is my command line as a final example after running
docker run -d -it --rm --name n8n -p 5678:5678 -e WEBHOOK_URL=https://DOMINIO.COM -v n8n_data:/home/node/.
n8n docker.n8n.io/n8nio/n8n

Thanks to everyone here because with your help I was able to do everything.

4 Likes

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