# Node-red inject node and debug nodes are not working correctly after deploying in rancher

**URL:** <https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176>\
**Category:** General\
**Created:** [31 July 2023 03:38 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176 "2023-07-31T03:38:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![hasikp1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasikp1/32/81635_2.png) [@hasikp1](https://discourse.nodered.org/u/hasikp1)\
**Post date:** [31 July 2023 03:38 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176/1 "2023-07-31T03:38:49Z")

</div>

I am using node-red version 2.2.2 and node.js version 12.22.8. This instance was deployed in rancher kubernetes management platform. When I use nodered v2.2.2 inject node and debug nodes are enabled but debug outputs are not showing in the the panel but I get successfully injected message. I also tried upgrading to nodered version 3.0.2 In that inject nodes and debug nodes cannot be enabled. What can be the reason for this any fix?, I tried npm update but it didn't fix the issue.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 July 2023 08:06 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176/2 "2023-07-31T08:06:49Z")

</div>

With node-red 3.0.2 start node red in a command window and post the startup log here.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [31 July 2023 08:20 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176/3 "2023-07-31T08:20:57Z")

</div>

> [@hasikp1](#):
>
> 3.0.2 In that inject nodes and debug nodes cannot be enabled.

it is likely you have an issue in your flows or a contrib node preventing the flows from starting on the server.

the second common reason is that websockets are blocked.

Check the browsers dev tools -\> network tab for any rad requests.

And as @Colin said - post your startup log.

And one additional question - where/how are you running node-red - docker? nas? rasp pi? windows? etc etc

---

<div class="post-metadata">

**Author:** ![hasikp1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasikp1/32/81635_2.png) [@hasikp1](https://discourse.nodered.org/u/hasikp1)\
**Post date:** [31 July 2023 10:14 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176/4 "2023-07-31T10:14:22Z")

</div>

Hi,  
Thank you for replying. Forum shows that new users cant upload attachments, so please find part of the log below.

```auto
31 Jul 09:55:05 - [warn] [node-red-contrib-mongodb4/mongodb4] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/mongodb/lib/bson.js
- /data/node_modules/mongodb/lib/utils.js
- /data/node_modules/mongodb/lib/operations/add_user.js
- /data/node_modules/mongodb/lib/admin.js
- /data/node_modules/mongodb/lib/index.js
- /data/node_modules/node-red-contrib-mongodb4/src/mongodb4.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] ------------------------------------------------------
31 Jul 09:55:05 - [info] Settings file : /data/settings.js
31 Jul 09:55:05 - [info] Context store : 'default' [module=memory]
31 Jul 09:55:05 - [info] User directory : /data
31 Jul 09:55:05 - [warn] Projects disabled : editorTheme.projects.enabled=false
31 Jul 09:55:05 - [info] Flows file : /data/flows.json
31 Jul 09:55:05 - [info] Server now running at http://127.0.0.1:1880/
31 Jul 09:55:05 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

31 Jul 09:55:05 - [info] Starting flows
31 Jul 09:55:05 - [info] Started flows
31 Jul 09:59:37 - [info] Stopping flows
31 Jul 09:59:37 - [info] Stopped flows
31 Jul 09:59:37 - [info] Updated flows
31 Jul 09:59:37 - [info] Starting flows
31 Jul 09:59:37 - [info] Started flows

```

In the browser developer options network shows following error also

```auto
Firefox can’t establish a connection to the server at wss://nodered-dashboard.test.lk/comms.

```

Thank you.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 July 2023 10:25 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176/5 "2023-07-31T10:25:28Z")

</div>

Please post the start of the log up to the error. Pasting it in is the correct way to do it.  
You didn't answer all of @Steve-Mcl's questions - in particular whether it is a docker install.

The node showing the error has not installed correctly, so I suggest you try installing that again.

---

<div class="post-metadata">

**Author:** ![hasikp1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasikp1/32/81635_2.png) [@hasikp1](https://discourse.nodered.org/u/hasikp1)\
**Post date:** [31 July 2023 10:47 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176/6 "2023-07-31T10:47:41Z")

</div>

Hi, Please find the full log.

```auto
31 Jul 09:55:04 - [info] 

Welcome to Node-RED
===================

31 Jul 09:55:04 - [info] Node-RED version: v3.0.2
31 Jul 09:55:04 - [info] Node.js version: v16.20.1
31 Jul 09:55:04 - [info] Linux 3.10.0-1160.el7.x86_64 x64 LE
31 Jul 09:55:05 - [info] Loading palette nodes
31 Jul 09:55:05 - [warn] ------------------------------------------------------
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Client] Error: Cannot find module '@xstate/fsm'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-client-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-client.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Read] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-read.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Getter] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-getter.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Flex-Getter] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-flex-getter.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Write] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-write.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Flex-Write] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-flex-write.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Server] Error: Cannot find module 'jsmodbus'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-server.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Flex-Server] Error: Cannot find module '@serialport/parser-byte-length'
Require stack:
- /data/node_modules/serialport/dist/index.js
- /data/node_modules/modbus-serial/index.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-flex-server.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Queue-Info] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-queue-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-queue-info.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-IO-Config] Error: Cannot find module 'line-by-line'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-io-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-io-config.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Response-Filter] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-response-filter.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-modbus/Modbus-Flex-Sequencer] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/node-red-contrib-modbus/modbus/core/modbus-core.js
- /data/node_modules/node-red-contrib-modbus/modbus/modbus-flex-sequencer.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] [node-red-contrib-mongodb4/mongodb4] Error: Cannot find module 'bson'
Require stack:
- /data/node_modules/mongodb/lib/bson.js
- /data/node_modules/mongodb/lib/utils.js
- /data/node_modules/mongodb/lib/operations/add_user.js
- /data/node_modules/mongodb/lib/admin.js
- /data/node_modules/mongodb/lib/index.js
- /data/node_modules/node-red-contrib-mongodb4/src/mongodb4.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
31 Jul 09:55:05 - [warn] ------------------------------------------------------
31 Jul 09:55:05 - [info] Settings file : /data/settings.js
31 Jul 09:55:05 - [info] Context store : 'default' [module=memory]
31 Jul 09:55:05 - [info] User directory : /data
31 Jul 09:55:05 - [warn] Projects disabled : editorTheme.projects.enabled=false
31 Jul 09:55:05 - [info] Flows file : /data/flows.json
31 Jul 09:55:05 - [info] Server now running at http://127.0.0.1:1880/
31 Jul 09:55:05 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

31 Jul 09:55:05 - [info] Starting flows
31 Jul 09:55:05 - [info] Started flows
31 Jul 09:59:37 - [info] Stopping flows
31 Jul 09:59:37 - [info] Stopped flows
31 Jul 09:59:37 - [info] Updated flows
31 Jul 09:59:37 - [info] Starting flows
31 Jul 09:59:37 - [info] Started flows

```

The flow I am using for testing is as following.

```auto
[
    {
        "id": "99177538a354aa2e",
        "type": "tab",
        "label": "Flow 5",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "6bacc885d0d54737",
        "type": "inject",
        "z": "99177538a354aa2e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 200,
        "y": 100,
        "wires": [
            [
                "9f7e4c52468117a0"
            ]
        ]
    },
    {
        "id": "9f7e4c52468117a0",
        "type": "debug",
        "z": "99177538a354aa2e",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 420,
        "y": 100,
        "wires": []
    }
]

```

@Steve-Mcl node-red is deployed in Rancher platform in our corporate servers.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 July 2023 10:53 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176/7 "2023-07-31T10:53:45Z")

</div>

As you can see, the install of nodes is messed up.  
I don't know anything about Rancher, but if this were a normal install I would recommend deleting the node\_modules folder, which in your system appears to be /data/node-modules, then, in a command window, going into /data and running  
`npm install`  
which should re-install all the required nodes. Watch for errors with this obviously.

As for the sockets connection problem then it appears that the browser cannot open a web socket connection to the server. That may be a Rancher problem.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [31 July 2023 11:29 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176/8 "2023-07-31T11:29:46Z")

</div>

As rancher is container based (think docker) your images will need the tools necessary for compiling certain nodes that have a build step (like serial port etc)

Covered many times on the forum. Search "[docker build serial](https://discourse.nodered.org/search?context=topic&context_id=80176&q=docker%20build%20serial&skip_context=true)"

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 August 2023 11:30 UTC](https://discourse.nodered.org/t/node-red-inject-node-and-debug-nodes-are-not-working-correctly-after-deploying-in-rancher/80176/9 "2023-08-14T11:30:41Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
