Connection lost

I dont understand point 5 and 6.
Where i have to create a docker-compose.yml?
And where i have to create that .env file and with which name?

Actually wherever you want. You just have to make sure that you create both files in the same folder and that you run the command from step 8 also in it.

There’s another problem. It says “address already in use” and thats right. We are using apache on our server and he cant use the local adress with 443 as the port.

Associating an IP address to a domain is the job of DNS. You need to register a DNS domain name with a domain provider and then point the domain to your external IP address.

If you just want to test out using a temporary domain, you can modify your hosts file with the domain name and IP address. So, for example, if your IP address was 1.2.3.4 and your domain was www.example.com, you would add the following line into your hosts file:

1.2.3.4       www.example.com

Your hosts file is in different locations, depending on the operating system that you are using:

  • Windows - C:\Windows\System32\drivers\etc\hosts
  • Linux - /etc/hosts
  • MacOS - /etc/hosts

Remember: You need to be root or administrator if you want to edit this file

Thanks a lot @Tephlon!

Here are some other topics @TimoG which talks about the same topic of port 443 being already in use:


I did the setup guide. But we created a dns record before that. So we have one thats active.
But its does not work with the dns record. And thats not the problem. The dns records works fine, but i cant start it.
My docker-compose file is the same as in the guide and my n8n.env looks like this:

n8n.env

Folder where data should be saved

DATA_FOLDER=/var/www/html/n8n/

The top level domain to serve from

DOMAIN_NAME=aundb.io

The subdomain to serve from

SUBDOMAIN=n8n

DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from

above example would result in: https://n8n.example.com

The user name to use for autentication - IMPORTANT ALWAYS CHANGE!

N8N_BASIC_AUTH_USER=******

The password to use for autentication - IMPORTANT ALWAYS CHANGE!

N8N_BASIC_AUTH_PASSWORD=******

Optional timezone to set which gets used by Cron-Node by default

If not set New York time will be used

GENERIC_TIMEZONE=Europe/Berlin

The email address to use for the SSL certificate creation

[email protected]

But i saw, that the docker-compose version is sadly not compatible with apache on the same server.
But it starts if i stop the apache2 service, but i cant open the interface with the domain. I dont get a secure connection.

Now i installed it on a new server without apache but it says now 4 warnings that variables of the .evn file are not set but they are in the n8n.env.
And the logs dont helping me in any way. It says that the file /home/node/.n8n exists but its definitly not. The folder node dont exists too.

Okey, i found a solution on my own. I though that i must create a .env file with any name, but i had to name it ONLY .env. Now it works.

Ah great to hear that you did figure it out. Because I read your answer and was confused why it would not work. Did somehow think you only wrote n8n.env to describe it and not that you actually named it that way. Sorry should have really caught that and then asked.

Hi all,

I am running into the same issue. I am running n8n dockerized. Using a docker-compose.yml file similar to the one in the setup guide, slightly modified to use the env file directly:

  n8n:
    image: n8nio/n8n:0.68.2-push-debug
    env_file: n8n.env
    container_name: n8n
    restart: always
    ports:
      - 5678:5678
    volumes:
      - ~/.n8n:/root/.n8n
      - /var/run/docker.sock:/var/run/docker.sock
    # Wait 5 seconds to start n8n to make sure that PostgreSQL is ready
    # when n8n tries to connect to it
    command: /bin/sh -c "sleep 5; ./packages/cli/bin/n8n start"

As you can see above, I tried the debugging version mentioned in the thread.

I, however, have nginx instead of traefik (I have other services already running behind nginx)

I can see:

  1. The n8n service actually picks up all the .env variables correctly.
  2. From the debug logs, I can see push requests reaching n8n:
        n8n                    |   method: 'GET',                                                                                                                                                                    
        n8n                    |   url: '/rest/push?sessionId=t26ga6pwy1e',                                                                                                                                          
        n8n                    |   query: { sessionId: 't26ga6pwy1e' }                                                                                                                                               
        n8n                    | }                                                                                                                                                                                   
        n8n                    | *** Is Push-Connect-Request                                                                                                                                                         
        n8n                    | *** Push-Connection gets added
        n8n                    | >> Push.add 1
        n8n                    | >> Push.add 3
        n8n                    | >> Push.disconnect
    

Yet, the Connection lost warning on the top right corner of the dashboard is present and I cannot execute any flow.

Any other idea of what might be happening?

Welcome to the community @jmrf!

If you use nginx it is maybe worth checking out this topic:

Thanks Jan!

Btw, I am Jose, the one you spoke to this morning from MeliorAI. Thanks for the link. Checking!

1 Like

Hi,

Could you please help how to fix this on a containerized environment. Because of connection lost my workflow is not working and i can see this message

“Problem running workflow
There was a problem running the workflow:
No active connection to server. It is maybe down.”

Honestly, it is totally impossible for me to fix this issue as I am unable to reproduce it.

How are you running n8n? Are you 100% sure that you do not have a reverse proxy or anything else (as discussed above) that could cause that problem?

I got the same error this morning and I knew what the issue was. I connected to my company’s network using their proxy servers. Once I did, n8n workflow page said “connection lost” and when I disconnected from the proxy and directly connected to the internet, the error was gone. So, I guess it’s got something to do with the security that’s set by my company. People facing the same issues may test the same in a different PC/network etc to check if that solves the issue.

2 Likes

Hey,

came here to leave a hint for everybody fighting with this problem.
From what I found, the issue is related to the compression. eg. If I remove the Accept-Encoding header from a curl request to /rest/push I get a quite prompt :ok response.

So for my case I’m running n8n in Kubernetes behind Traefik Proxy.
What I had to do was to edit the traefik configmap and disable the compression for both entry points:

[entryPoints]
  [entryPoints.http]
  address = ":80"
  compress = false
  [entryPoints.https]
  address = ":443"
  compress = false

The same should be possible for other reverse Proxies as well.
Hope that helps!

4 Likes

Welcome to the community @anthu!

Thanks a lot for directly helping others with their problem in your very first post. Really great!

2 Likes

Hi!
I have the same problem.
For me, it looks like a nginx config problem (set as a reverse proxy).
I tried to disable buffering and enabled chunked encoding like the documentation showed but nothing works.
I observe one of the following behavior:

  • the push request returns to the browser correctly and a connection error is reported
  • the push request does not return, no connection error is reported but responses from execution of flows are not returned either (the ui is blocked in “Executing workflows”)

If I may, I’d like to suggest an alternative way of polling data from the server:
From what I saw, a lot of proxies/web servers have issues with chunked data and require fine tuning.

It could be more robust to to do this long polling with multiple requests:

  • send the “push” request
  • return the full response even if there is nothing to return from the server after x seconds (or after timeout)
  • sent a new the “push” request as soon as the previous one returns to keep the connection with the server alive
  • and so on…

Of course there is a slight bandwidth loss due to the multiple packet headers but it should not be significant…

Welcome to the community @dcretin!

In my experience does really everything come with advantages but also disadvantages. There are for sure some problems with EventSource, but considering how many people are using n8n worldwide, are they still quite limited and normally a solution can be found. For that reason. am I very hesitant the change something which generally works, just to replace it with a new unkown set of problems, especially if we have currently very limited resources.

But generally agree that this is something we have to improve at some point. Sadly do we have currently already so much to do, with many other very high impact features and issues, that we have to prioritize and for that reason do not know when we can tackle this. Sorry.

I use n8n with the kubernetes helm chart.
You only need to set the following annotation:
ingress.kubernetes.io/compress-enable: “false”

Would be nice if this would be included by default in the helm chart…

It is described here: k8s-ts-ingress/compression.md at master · torchbox/k8s-ts-ingress · GitHub

Anyway, thank you for the hint with compress :slight_smile:
Peter

1 Like