Lost Connection Once Container Started

Describe the issue/error/question

The UI basically loses a connection to the server once a workflow is triggered. Going back to the workflows page and clicking on the workflow again then shows the connection lost message.

It appears that the push call is pending for an extremely long period of time. The behavior appears the same at home and at work (with and without proxies). I’ve not tried running it without docker as that is my use case.

What is the error message (if any)?

No error messages, apart from not connected

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.204.0
  • Database you’re using (default: SQLite): default
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker - both Docker CE and Docker Desktop (via WSL)

This is the super basic compose file I’m running:

version: '3.8'

volumes:
  n8n_storage:

services:
  n8n:
    image: n8nio/n8n
    restart: unless-stopped
    ports:
      - 5678:5678
    environment:
      - GENERIC_TIMEZONE=Australia/Brisbane
    volumes:
      - n8n_storage:/home/node/

Hey @rxc3ntr1c, the “lost connection” would appear if n8n’s frontend can’t talk to the API. This would for example happen if the server (or container) n8n is running on crashes.

So perhaps you can take a look at the logs for your docker container in a first step to see what’s going on? If you’re using docker compose, the simplest way to view these would be running docker compose logs in the directory of your compose file.

No errors from what I can see.

n8n-n8n-1       | 2022-12-02T04:56:53.521Z | verbose  | Initializing n8n sub-process "{\n  pid: 65,\n  workflowId: '1',\n  file: 'WorkflowRunnerProcess.js',\n  function: 'runWorkflow'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.539Z | verbose  | Workflow execution started "{\n  workflowId: '1',\n  file: 'WorkflowExecute.js',\n  function: 'processRunExecutionData'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.541Z | debug    | Received child process message of type processHook for execution ID 2. "{ executionId: '2', file: 'WorkflowRunner.js' }"
n8n-n8n-1       | 2022-12-02T04:56:53.541Z | debug    | Start processing node "On clicking 'execute'" "{\n  node: \"On clicking 'execute'\",\n  workflowId: '1',\n  file: 'WorkflowExecute.js'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.541Z | debug    | Executing hook (hookFunctionsPush) "{\n  executionId: '2',\n  sessionId: 'd45019n7wdb',\n  workflowId: '1',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteBefore'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.542Z | debug    | Send data of type "executionStarted" to editor-UI "{\n  dataType: 'executionStarted',\n  sessionId: 'd45019n7wdb',\n  file: 'Push.js',\n  function: 'send'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.542Z | debug    | Running node "On clicking 'execute'" started "{\n  node: \"On clicking 'execute'\",\n  workflowId: '1',\n  file: 'WorkflowExecute.js'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.542Z | debug    | Received child process message of type processHook for execution ID 2. "{ executionId: '2', file: 'WorkflowRunner.js' }"
n8n-n8n-1       | 2022-12-02T04:56:53.543Z | debug    | Executing hook on node "On clicking 'execute'" (hookFunctionsPush) "{\n  executionId: '2',\n  sessionId: 'd45019n7wdb',\n  workflowId: '1',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'nodeExecuteBefore'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.543Z | debug    | Send data of type "nodeExecuteBefore" to editor-UI "{\n  dataType: 'nodeExecuteBefore',\n  sessionId: 'd45019n7wdb',\n  file: 'Push.js',\n  function: 'send'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.543Z | debug    | Running node "On clicking 'execute'" finished successfully "{\n  node: \"On clicking 'execute'\",\n  workflowId: '1',\n  file: 'WorkflowExecute.js'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.543Z | debug    | Received child process message of type processHook for execution ID 2. "{ executionId: '2', file: 'WorkflowRunner.js' }"
n8n-n8n-1       | 2022-12-02T04:56:53.544Z | debug    | Executing hook on node "On clicking 'execute'" (hookFunctionsPush) "{\n  executionId: '2',\n  sessionId: 'd45019n7wdb',\n  workflowId: '1',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'nodeExecuteAfter'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.544Z | verbose  | Workflow execution finished successfully "{\n  workflowId: '1',\n  file: 'WorkflowExecute.js',\n  function: 'processSuccessExecution'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.544Z | debug    | Send data of type "nodeExecuteAfter" to editor-UI "{\n  dataType: 'nodeExecuteAfter',\n  sessionId: 'd45019n7wdb',\n  file: 'Push.js',\n  function: 'send'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.544Z | debug    | Received child process message of type processHook for execution ID 2. "{ executionId: '2', file: 'WorkflowRunner.js' }"
n8n-n8n-1       | 2022-12-02T04:56:53.545Z | debug    | Executing hook (hookFunctionsSave) "{\n  executionId: '2',\n  workflowId: '1',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteAfter'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.547Z | debug    | Received child process message of type end for execution ID 2. "{ executionId: '2', file: 'WorkflowRunner.js' }"
n8n-n8n-1       | 2022-12-02T04:56:53.549Z [Rudder] debug: no existing flush timer, creating new one
n8n-n8n-1       | 2022-12-02T04:56:53.550Z | debug    | Executing hook (hookFunctionsPush) "{\n  executionId: '2',\n  sessionId: 'd45019n7wdb',\n  workflowId: '1',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteAfter'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.550Z | debug    | Save execution progress to database for execution ID 2  "{\n  executionId: '2',\n  workflowId: '1',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteAfter'\n}"
n8n-n8n-1       | 2022-12-02T04:56:53.550Z | debug    | Send data of type "executionFinished" to editor-UI "{\n  dataType: 'executionFinished',\n  sessionId: 'd45019n7wdb',\n  file: 'Push.js',\n  function: 'send'\n}"
n8n-n8n-1       | 2022-12-02T04:57:13.559Z [Rudder] debug: in flush
n8n-n8n-1       | 2022-12-02T04:57:13.559Z [Rudder] debug: skipping flush, earlier flush in progress
n8n-n8n-1       | 2022-12-02T04:57:33.849Z | debug    | Wait tracker querying database for waiting executions "{ file: 'WaitTracker.js', function: 'getWaitingExecutions' }"

Even though it says “Send data of type “executionFinished” to editor-U” I don’t actually see any requests or traffic on the dev tools network panel via push.

What do I need to put in a Postman request to push for it to recognise the request? Can I use basic auth? If I just try to hit the push url witht he session key I get 401 unauthorised.

For what it’s worth running it via npx works fine :expressionless:

1 Like

If this works fine outside of docker, but fails for your docker container there might a problem with your local configuration, though I am not sure what exactly might cause the behaviour if no proxies are involved.

When running the n8n docker container locally, are you using any hostname other than localhost?