# Uncaught Exception crashing Node-RED, uncertain how to proceed

**URL:** <https://discourse.nodered.org/t/uncaught-exception-crashing-node-red-uncertain-how-to-proceed/84903>\
**Category:** General\
**Created:** [25 January 2024 09:32 UTC](https://discourse.nodered.org/t/uncaught-exception-crashing-node-red-uncertain-how-to-proceed/84903 "2024-01-25T09:32:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kingwizar](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kingwizar/32/87646_2.png) [@Kingwizar](https://discourse.nodered.org/u/Kingwizar)\
**Post date:** [25 January 2024 09:32 UTC](https://discourse.nodered.org/t/uncaught-exception-crashing-node-red-uncertain-how-to-proceed/84903/1 "2024-01-25T09:32:16Z")

</div>

Hello,

I'm experiencing a problem with Node-RED. It consistently reports that there is no connection, and I'm uncertain about how to proceed with troubleshooting this issue.

```auto
25 Jan 10:26:12 - [info]

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

25 Jan 10:26:12 - [info] Node-RED version: v3.1.3
25 Jan 10:26:12 - [info] Node.js version: v20.9.0
25 Jan 10:26:12 - [info] Windows_NT 10.0.22621 x64 LE
25 Jan 10:26:13 - [info] Loading palette nodes
25 Jan 10:26:13 - [info] Dashboard version 3.6.1 started at /ui
25 Jan 10:26:13 - [info] Settings file : C:\Users\nizar_n31aszd\.node-red\settings.js
25 Jan 10:26:13 - [info] Context store : 'default' [module=memory]
25 Jan 10:26:13 - [info] User directory : \Users\nizar_n31aszd\.node-red
25 Jan 10:26:13 - [warn] Projects disabled : editorTheme.projects.enabled=false
25 Jan 10:26:13 - [info] Flows file : \Users\nizar_n31aszd\.node-red\flows.json
25 Jan 10:26:13 - [info] Server now running at http://127.0.0.1:1880/
25 Jan 10:26:14 - [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.
---------------------------------------------------------------------

25 Jan 10:26:14 - [info] Starting flows
25 Jan 10:26:14 - [error] [ui_led:39f0631ff454fec7] ui_led.error.no-group
25 Jan 10:26:14 - [info] [remote-access:3ded0a56c6ab5471] Server: nodered02.remote-red.com InstanceHash: lxtanj4ngganddgxhicg6ig24mmo5szayv88mybma2ehgrwc5tpji2zr2axu5rdq
25 Jan 10:26:14 - [info] Started flows
(node:7852) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\Users\nizar_n31aszd\.node-red\node_modules\node-red-contrib-azureiothubnode\node_modules\azure-iot-amqp-base\package.json' of 'main.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:7852) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\Users\nizar_n31aszd\.node-red\node_modules\node-red-contrib-azureiothubnode\node_modules\azure-iot-mqtt-base\package.json' of 'main.js'. Please either fix that or report it to the module author
25 Jan 10:26:14 - [error] [MySQLdatabase:database] Error: connect ECONNREFUSED 127.0.0.1:3306
25 Jan 10:26:14 - [info] [mqtt-broker:1c432e291f825d5c] Connected to broker: mqtt://mqtt.ci-ciad.utbm.fr:1883
25 Jan 10:26:14 - [info] [remote-access:3ded0a56c6ab5471] Using nodered02.remote-red.com on port 51472
25 Jan 10:26:14 - [info] [remote-access:3ded0a56c6ab5471] starting ssh process
25 Jan 10:26:19 - [info] [azureiothub:Azure] Connection to IoT Hub not established or configuration changed. Reconnecting.
25 Jan 10:26:19 - [info] [azureiothub:Azure] Connecting to Azure IoT Hub:
   Protocol: mqtt
   Connection string :HostName=testarduino.azure-devices.net;DeviceId=arduinotest1;SharedAccessKey=RklY5u4GRhf/53YDmbf3/AtHxMiTH3dGfAIoTNeyDOM=
25 Jan 10:26:19 - [info] [azureiothub:Azure] Connected to Azure IoT Hub.
25 Jan 10:26:19 - [info] [azureiothub:Azure] Message is pending. Sending it to Azure IoT Hub.
25 Jan 10:26:19 - [info] [azureiothub:Azure] Sending Message to Azure IoT Hub :
   Payload: [object Object]
25 Jan 10:26:19 - [red] Uncaught Exception:
25 Jan 10:26:19 - [error] TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Object
    at new NodeError (node:internal/errors:406:5)
    at Function.byteLength (node:buffer:775:11)
    at publish (C:\Users\nizar_n31aszd\.node-red\node_modules\mqtt-packet\writeToStream.js:334:51)
    at Object.generate [as writeToStream] (C:\Users\nizar_n31aszd\.node-red\node_modules\mqtt-packet\writeToStream.js:34:14)
    at sendPacket (C:\Users\nizar_n31aszd\.node-red\node_modules\mqtt\lib\client.js:168:29)
    at storedPacket (C:\Users\nizar_n31aszd\.node-red\node_modules\mqtt\lib\client.js:224:5)
    at Store.put (C:\Users\nizar_n31aszd\.node-red\node_modules\mqtt\lib\store.js:42:5)
    at storeAndSend (C:\Users\nizar_n31aszd\.node-red\node_modules\mqtt\lib\client.js:219:24)
    at MqttClient._sendPacket (C:\Users\nizar_n31aszd\.node-red\node_modules\mqtt\lib\client.js:1234:7)
    at publishProc (C:\Users\nizar_n31aszd\.node-red\node_modules\mqtt\lib\client.js:649:14)
    at MqttClient.publish (C:\Users\nizar_n31aszd\.node-red\node_modules\mqtt\lib\client.js:659:74)
    at constructor.publish (C:\Users\nizar_n31aszd\.node-red\node_modules\node-red-contrib-azureiothubnode\node_modules\azure-iot-mqtt-base\lib\mqtt_base.js:122:43)
    at constructor.handle (C:\Users\nizar_n31aszd\.node-red\node_modules\machina\lib\machina.js:613:25)
    at Fsm.<computed> [as handle] (C:\Users\nizar_n31aszd\.node-red\node_modules\machina\lib\machina.js:466:63)
    at MqttBase.publish (C:\Users\nizar_n31aszd\.node-red\node_modules\node-red-contrib-azureiothubnode\node_modules\azure-iot-mqtt-base\lib\mqtt_base.js:240:19)
    at constructor.sendEvent (C:\Users\nizar_n31aszd\.node-red\node_modules\node-red-contrib-azureiothubnode\node_modules\azure-iot-device-mqtt\lib\mqtt.js:275:37)

```

---

<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:** [25 January 2024 09:40 UTC](https://discourse.nodered.org/t/uncaught-exception-crashing-node-red-uncertain-how-to-proceed/84903/2 "2024-01-25T09:40:54Z")

</div>

> [@Kingwizar](#):
>
> problem with Node-RED. It consistently reports that there is no connection

The no connection will be related to the fact it is being crashed.

> [@Kingwizar](#):
>
> ```auto
> at constructor.publish (C:\Users\nizar_n31aszd\.node-red\node_modules\node-red-contrib-azureiothubnode\node_modules\azure-iot-mqtt-base\lib\mqtt_base.js:122:43)
> 
> ```

As you can see from this line, the cause of the problem is `node-red-contrib-azureiothubnode`

My first question is why are you using this? I am not certain it offers anything the built in MQTT nodes cannot do.

As for recovery, start node-red in safe mode and disable the azure mqtt nodes then deploy.

Use `node-red --safe` to start in safe mode.

---

<div class="post-metadata">

**Author:** ![Kingwizar](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kingwizar/32/87646_2.png) [@Kingwizar](https://discourse.nodered.org/u/Kingwizar)\
**Post date:** [25 January 2024 09:43 UTC](https://discourse.nodered.org/t/uncaught-exception-crashing-node-red-uncertain-how-to-proceed/84903/3 "2024-01-25T09:43:34Z")

</div>

thank you very much, that debug my Node-red, but do you have an idea how to connect the node-red with a devide from azure like azure IoT hub?

---

<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:** [25 January 2024 09:47 UTC](https://discourse.nodered.org/t/uncaught-exception-crashing-node-red-uncertain-how-to-proceed/84903/4 "2024-01-25T09:47:34Z")

</div>

First result from google: [Connecting Node-Red to Azure IoT Hub using MQTT nodes. | by Nikhil Kinkar | Medium](https://medium.com/@nikhilkinkar/connecting-node-red-to-azure-iot-hub-using-mqtt-nodes-6e9160549348)

Any good?

Or perhaps [https://azure.microsoft.com/en-us/blog/connecting-node-red-to-azure-iot-central/](https://azure.microsoft.com/en-us/blog/connecting-node-red-to-azure-iot-central/) ? (3rd search result)

---

<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:** [24 April 2024 09:48 UTC](https://discourse.nodered.org/t/uncaught-exception-crashing-node-red-uncertain-how-to-proceed/84903/5 "2024-04-24T09:48:15Z")

</div>

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