Lost Connection to server, reconnecting on AWS linux

I have a new node-red running on a new AWS instance (after my 2017 was getting too old:-).

Anyway, it's working nicely, but I'm getting the lost connection to server message:

Lost connection to server, reconnecting in 54s. [Try now]

I searched this forum and see the same error. I'm not running a dashboard

I can edit nodes and deploy, but instantly it gives the lost connection error, but is deployed correctly.

Thanks.

Check the cpu usage on the instance in case something in the flows is looping or otherwise clogging things up, and consuming all your processor power.

I checked an my AWS CPU is only at 1.24% (I assume that's out of 100%).

The side effect of this lost connection is those "inject" nodes cannot be clicked on to test things.

The Editor uses raw websockets AFAIK for things like the inject nodes.

Websockets can be rather temperamental over the Internet. Check to see whether you are getting any errors in your browser console.

Also, are you having to go through any proxy servers between your client and AWS? If so, it is possible that they are being a bit overly agressive.

Ah, spotted this advice:

AWS Application Load Balancers (ALB) default to a 60-second idle timeout , which kills persistent WebSocket connections. Increase the ALB idle timeout to at least 3600 seconds and enable sticky sessions on the target group to maintain state.

Obviously, you must also make sure you are using HTTPS (and therefore WSS) throughout.

I'm using HTTPS, have no proxy servers, and I don't see any "Load Balancers" on my AWS site.

Errors in the browser console?

If not, check the network tab to see if there is a fairly consistent timeframe for the disconnect/reconnect.

No console errors. Network seems fine. I'm on the linux shell all the time, and nothing on the network tab that I can see. Any debug I can turn on?

I think so. Sorry, I don't use AWS though. Try asking an AI - that's what I did. :rofl:

I was thinking node-red debug. I have pm2 and nothing stands out either.

It's just strange as editing and all that works, it's just the lost connection.

Well you can try turning up the logging level but not sure it will help.

This error is a network-level issue basically. An issue (or combination of issues) on the networks between your browser and the AWS host. It isn't a Node-RED issue as such.

Strange. I wasn't getting this issue on my older node-red on an adjacent old AWS instance.
So I'll search AWS more.
thanks for trying..

What do you do to make the error go away?

Sorry can you clarify? The error is still happening.

I understood you to say that when you deploy that you see, in the browser, a connection failed popup, but you then said that you can carry on doing things. What happens to make the popup go away?

Also, open the developer tools and select the Network tab. Refresh the page and look for the entry of type websockets and see what it says. I suspect that it is not connecting.

  1. "I can carry on doing things" - but the "popup" is at the top of the screen and stays open

Lost connection to server, reconnecting in 16s. [Try now]

  1. As for network and web sockets .. I assume on AWS server? I don't see anything about web sockets. What ports are being used? Maybe I don't have that port open on AWS? I use port 2000 for node-red.

You should see something like this
image

Try googling for how to enable websocket access on AWS server.

Websocket connections are a bit odd. They initially connect over HTTP(S) so they are on the same port as the Node-RED admin ExpressJS server (1880 by default). But they then "upgrade" their connection to WS(S). In your network tab, you should see an entry with a "101" code:


(This one is on port 1885 because this is my v5 beta instance).

I'm not seeing anything like you show. There are 3 areas I have control:

  1. the processes on the box (eg node-red), so a "ps -ef" shows things there.
  2. the ports open, so my 2000 (for my node-red)
  3. some high level AWS things (but not at the process level, or the web socket).

If there should be another port open (for this ExpressJS then that would be nice to know).

I DO NOT see a window like you show with "headers, messages, initiator, timing".

thanks.