Connection lost

Hello guys,

i have a problem with n8n. To start it i use the following command:
docker run -it --rm --name n8n -p 5678:5678 n8nio/n8n

Before that i installed nodejs and python, but nothing else. Server running ubuntu 18.04.
After starting with docker, i get access to the web panel if i write ServerIP:5678 in the browser, but it says at the top right “Connection Lost” and i cant save anything.
I hope anyone can help me.

Kind regards,
Timo

1 Like

Welcome to the community @TimoG!

Wow that is strange. I did never hear about such a problem for people that run n8n locally and connect directly. This normally happens only if there is a reverse proxy in front of n8n which does not allows to connect via ServerSentEvents. Is there anything which could block it like for example a Firewall?

Btw. if you run n8n in Docker there is no need to install Node.js or Python locally.

We using only ufw as a firewall and there we forwarded the port. But we still have that issue, if we disable the firewall.

And there is also no firewall or similar on the machine which tries to access n8n that could block it? Because I sadly have no other idea what else could cause problems for you if there is nothing in front of n8n and also no firewall.

No i dont think so. We have this on two different servers and both are, except some hardening things like fail2ban or on my server a invoice ninja installation. But there is not another firewall. And i dont think that there is another thing that can block it.
The other server was a clean ubuntu installation.

Hey @TimoG! Welcome to the n8n community!

So, as it turns out, I am running into the exact same problem. I’ve seen this on both an Ubuntu 18.04 and the more recent Ubuntu 20.04. But, there are some differences which may lead us in the right direction.

Where you are using the docker installation, I did a clean Ubuntu install with the following:

  • NPM 6.14.4
  • NodeJS 12.17.0
  • n8n 0.67.3

I am also running n8n using the PM2 service so that it runs automatically when the server launches without me needing to log in. I did the installation with a variation of my n8n-pi installation script that I am building for Debian/Ubuntu systems.

When I connect into the webUI, I get this:


Note the highlighted area in the top right corner.

I’m now starting to troubleshoot some of this and I think it is actually a networking thing as I’ve also seen this when I use a VPN. I’ll update this post as I discover what is and what is not a part of the issue and also how I resolved the problem.

4 Likes

Hey @Tephlon,
As it turns out, I am also running into this. Worked fine yesterday and it appeared this morning when I opened my laptop. N8N running in Docker behind traefik. The UI is fine otherwise, allowing me to browse workflows, save them, reload the page… The workflows are also running fine on their own. So the only issue seems to not be able to run them from the interface.
Running 0.67.3:ubuntu as per @jan 's suggestion

Edit: And… it’s back up…
Edit2: And… it’s back down…

We have the same issue. Running N8N 0.66.0. Since today all server that are running the N8N docker image report “Connection lost”.

How can that be? I thought N8N works without using any online service? So it is very strange that different users experiencing the same issue at the same time.

Wow that is getting weirder and weirder. For me it still works totally fine. There are no external online services used. So that can not be it. Normally it could be that some kind of package on which n8n depends upon changed. That is however also unlikely to be the problem as it also happens when docker gets used and the packages in it did not change. So I wonder if it is something external like for example the browser or whatever.

For all the people that have problems:

  • What browser are you using?
  • What operating system are you using?
  • Did you do any software upgrade on computer or server?
What browser are you using?

Chrome (latest) / Firefox (latest) / Opera (latest)

What operating system are you using?

Windows 10 / macOs

Did you do any software upgrade on computer or server?

Maybe some auto (security) updates. Running Ubuntu 18.04.3 LTS. But we use N8N only in docker containers so this should have no effect.

Also running on the latest Chrome.
Are there supposed to be network calls? I refreshed the page, made sure it displayed “Connection lost” and opened the devtools on the Network tab. Left it opened, came back a while after and it was back to “Active” with the “Connection lost” label gone. Apparently there hadn’t been any network calls.
For what it’s worth, here’s what my console shows, but some messages are probably linked to extensions I used…

edit: Just tried again by clearing the console and the network. After a while “connection lost” goes away and the console/network are still clean…

hm I am also using Chrome, Ubuntu on Desktop & Server. I just upgraded our server with all the latest packages of everything and hoped to so “break” n8n. Sadly no luck. It still works fine for me.

@jan can you add some logs and compile it in a docker image? We can’t really help with more details since the logging of N8N (front end and back end) shows no problems.

I actually saw this yesterday as well and you guys beat me to the punch!
These are the errors that I see:

DevTools failed to load SourceMap: Could not load content for webpack://Quill/node_modules/quill-delta/dist/Delta.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for webpack://Quill/node_modules/quill-delta/dist/AttributeMap.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for webpack://Quill/node_modules/quill-delta/dist/Op.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for webpack://Quill/node_modules/quill-delta/dist/Iterator.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://abnnemjpaacaimkkepphpkaiomnafldi/common/browser-polyfill.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for http://192.168.1.107:5678/js/chunk-vendors.bf96dbbc.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load SourceMap: Could not load content for http://192.168.1.107:5678/js/app.ed1efe97.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

But when I go to the Sources tab in the DevTools and look for a resource that it cannot find, I find it at webpack://Quill/./Node_modules/quill-delta/dist/Delta.js when the running code is looking for webpack://Quill/Node_modules/quill-delta/dist/Delta.js. I think there is a simple setting somewhere in the source that pointing to the wrong directory.

SourceMaps are only useful for debugging and contain additional information about the structure of the written code since normally the js code is minified and hard to debug. That means that missing SourceMaps are propably not an issue.

More about SourceMaps

1 Like

Yes the source maps are for sure not the problem

Will look into releasing a docker image which outputs debugging information.

Ok sadly do not really know what to log exactly. What it now outputs is some basic information about every request n8n receives and some info-messages when it is a push-connection-request (this are the ones that do not work).

The images is: n8nio/n8n:0.68.2-push-debug

I hope like that we can at least see if the requests reach n8n or not.

image goes into restart loop:

/bin/sh: n8n: not found
ln: /home/node/.n8n: File exists
/bin/sh: n8n: not found
ln: /home/node/.n8n: File exists
/bin/sh: n8n: not found
ln: /home/node/.n8n: File exists
/bin/sh: n8n: not found
ln: /home/node/.n8n: File exists
/bin/sh: n8n: not found
ln: /home/node/.n8n: File exists
/bin/sh: n8n: not found
ln: /home/node/.n8n: File exists
/bin/sh: n8n: not found
ln: /home/node/.n8n: File exists
/bin/sh: n8n: not found

It is a custom build image so it is slightly different than the n8n default which uses npm modules. If you start it normally locally for debugging purpose it works totally fine like any other n8n image:

docker run -it --rm -p 5678:5678 n8nio/n8n:0.68.2-push-debug
# or
docker run -it --rm -p 5678:5678 n8nio/n8n:0.68.2-push-debug n8n start --tunnel

If you need something special, exactly like in our earlier conversation, you have to adjust it exactly the same way:


You can also do that:

docker run -it --rm -p 5678:5678 n8nio/n8n:0.68.2-push-debug /bin/sh -c "sleep 5; ./packages/cli/bin/n8n start"

Doesn’t work:

/bin/sh: ./packages/cli/bin/n8n: not found
ln: /home/node/.n8n: File exists

n8n:
  image: n8nio/n8n:0.68.2-push-debug
  // ...
  command: /bin/sh -c "sleep 5; ./packages/cli/bin/n8n start"