FlowFuse / FlowFuse/flowfuse

Remote Instance editor lost connection after FlowFuse Platform restart

Open
#8,259 0 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
JavaScript
Stars
400
Forks
89
Avg merge
1d 21h
Merged PRs (30d)
146

Description

### Current Behavior

When working in the Node-RED editor for a Remote Instance, a "Lost connection to server" banner is shown. The editor tries to reconnect but fails every time.
This is problematic when a flow is under development - a flow is not deployed, and the whole work is lost on editor reload.

Observations:

1. Remote Instance log contains 502 http error

```
[AGENT] 24.08.2026 18:31:02 [warn] Editor tunnel error: Error: Unexpected server response: 502
socket.error Error: Unexpected server response: 502
at ClientRequest. (/opt/flowfuse-device/node/lib/node_modules/@flowfuse/device-agent/node_modules/ws/lib/websocket.js:930:7)
at ClientRequest.emit (node:events:519:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:780:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:125:17)
at TLSSocket.socketOnData (node:_http_client:615:22)
at TLSSocket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:189:23)
[AGENT] 24.08.2026 18:31:02 [info] Editor tunnel closed
```

2. In the browser, each GET request to ` /api/v1/devices/5oLeJdPGjl/editor/proxy/comms` ends with 502 error:

Request headers (obfuscated):
```
GET /api/v1/devices/5oLeJdPGjl/editor/proxy/comms HTTP/1.1
Host: app.flowfuse.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:153.0) Gecko/20100101 Firefox/153.0
Accept: */*
Accept-Language: pl,en-US;q=0.9,en;q=0.8
Accept-Encoding: gzip, deflate, br, zstd
Sec-WebSocket-Version: 13
Origin: https://app.flowfuse.com
Sec-WebSocket-Extensions: permessage-deflate
Sec-WebSocket-Key: <--REDACTED-->
Connection: Upgrade
Cookie: FFSESSION=<--REDACTED-->; FFSESSION=<--REDACTED-->; irrelevant_cookies_removed
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: websocket
Sec-Fetch-Site: same-origin
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
```

Response headers:
```
HTTP/1.1 502 Bad Gateway
Content-Type: text/plain; charset=utf-8
Content-Length: 53
Connection: close
Date: Mon, 24 Aug 2026 16:44:49 GMT
Set-Cookie: FFSESSION=<--REDACTED-->; Path=/api/v1/devices
X-Cache: Error from cloudfront
Via: 1.1 b97fc91ec89e8dcf1c9e7c533bd354fa.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: WAW51-P3
X-Amz-Cf-Id: ZdLBb35xYOwEZ3P9HmHlrTYUGtPohVGHFjWQ6DUzw48jgaOmr3OaOg==
```

Ingress controller logs available [here](https://insights.flowfuse.com/explore?schemaVersion=1&panes=%7B%22f9o%22:%7B%22datasource%22:%22P8E80F9AEF21F6940%22,%22queries%22:%5B%7B%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22P8E80F9AEF21F6940%22%7D,%22editorMode%22:%22code%22,%22expr%22:%22%7Bapp%3D%5C%22traefik%5C%22%7D%20%7C%20pattern%20%60%3Cclient_ip%3E%20-%20-%20%5B%3Ctimestamp%3E%5D%20%5C%22%3Cmethod%3E%20%3Cpath%3E%20%3Cprotocol%3E%5C%22%20%3Cstatus%3E%20%3Cbytes%3E%20%5C%22%3Creferer%3E%5C%22%20%5C%22%3Cuser_agent%3E%5C%22%20%3Crequest_id%3E%20%5C%22%3Crouter%3E%5C%22%20%5C%22%3Cupstream%3E%5C%22%20%3Cduration%3E%60%20%7C%20path%3D~%5C%22.%2B%2F5oLeJdPGjl%2F.%2B%5C%22%20%7C%20status%3D502%22,%22queryType%22:%22range%22,%22refId%22:%22A%22%7D%5D,%22range%22:%7B%22from%22:%221787589000000%22,%22to%22:%221787589300000%22%7D%7D%7D&orgId=1).

Application logs available [here.](https://insights.flowfuse.com/explore?schemaVersion=1&panes=%7B%22f9o%22:%7B%22datasource%22:%22P8E80F9AEF21F6940%22,%22queries%22:%5B%7B%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22P8E80F9AEF21F6940%22%7D,%22editorMode%22:%22builder%22,%22expr%22:%22%7Bapp%3D%5C%22flowforge%5C%22%7D%20%7C%3D%20%605oLeJdPGjl%60%20%7C%20json%20%7C%20res_statusCode%20%3D%20%60502%60%22,%22queryType%22:%22range%22,%22refId%22:%22A%22%7D%5D,%22range%22:%7B%22from%22:%221787589000000%22,%22to%22:%221787589300000%22%7D%7D%7D&orgId=1)

### Expected Behavior

Preferably, the editor should reconnect to the remote server so the user can continue their work.

### Steps To Reproduce

1. Deploy Remote Instance
2. Enable Development Mode
3. Open Remote Instance editor
4. Restart the Forge app
5. The connection to the remote server is lost in the editor

### Environment

- FlowFuse version: FlowFuse Cloud
- Node.js version:
- npm version:
- Platform/OS:
- Browser: Firefox 153.0.3

### Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure using the listed Remote Instance steps, then inspect the /api/v1/devices/{id}/editor/proxy/comms WebSocket endpoint alongside the provided agent, ingress, and application logs. Done means the editor reconnects after a Forge app or platform restart and preserves the user's undeployed flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, cloud, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.