lcarli / NodeRedIoTHub

Fork from origin plus changes
Apache License 2.0
13 stars 24 forks source link

TypeError: this.mqttprovider.connect is not a function #23

Open DanielT2408 opened 6 years ago

DanielT2408 commented 6 years ago

Hello Ladies and Gentlemen, i updated my node from version 0.3.0 to 0.4.0. Now after a period of time nearly from 30 mintes to one our i get this error: TypeError: this.mqttprovider.connect is not a function.

After this error Node-Rred reboots and the node shows me the status error. After that i can´t send no messages to Azure. I have to delete the node, add a new one and configure the node. After the deploy it is possible to send new messages.

I tested different internet-connections and different devices. On both systems the same problem with the new version.

Iam using Node Red version 0.18 and node.js v8.9.4.

Has someone else the same Problem? Thank you for your answer.

Best regards Daniel

failure mqtt

SjefFransen1 commented 5 years ago

Hi Daniel, I have the same problem in my setup. With exactly the same error message. I don't know if it is after 30 minutes, but it seems a random time-out. Do you have already success on solving the issue or addressing the cause of the problem? Kind regards, Sjef

madsenmj commented 5 years ago

I've seen the same issue with 0.4.0

SjefFransen1 commented 5 years ago

After 1 month of trying to find the issue I still have no luck in determining. So far I just reset node-red and everything works, but I don't think that this should be the way to do it.

markrad commented 5 years ago

I'm seeing the same problem. My suspicion is that the module is attempting to reconnect after the SAS token is nearing or has expired. For me it appears to fail after 45 minutes. Attached is a flow that has a 100% failure for me. It will need the device id, key, hub name, etc added in order to run it. nodeRedIoTSample.txt

Here is my console log:

20 Sep 10:57:08 - [info] [azureiothub:Azure IoT Hub]  messageJSON.data=[object Object]
20 Sep 10:57:08 - [info] [azureiothub:Azure IoT Hub] message=[object Object]
20 Sep 10:57:08 - [info] [azureiothub:Azure IoT Hub] Sending Message to Azure IoT Hub :
   Payload: {"B06State":"NOT RUNNING","B06Autorun":0,"B06PyroTube":565.650547,"B06Band":59.9239237}
20 Sep 10:57:08 - [info] [azureiothub:Azure IoT Hub] --->[object Object]
20 Sep 10:57:08 - [info] [azureiothub:Azure IoT Hub] Message sent.
20 Sep 10:57:22 - [red] Uncaught Exception:
20 Sep 10:57:22 - TypeError: this.mqttprovider.connect is not a function
    at Mqtt.connect (C:\Users\markrad\node_modules\node-red-contrib-azure-iot-hub\node_modules\azure-iot-mqtt-base\lib\mqtt.js:71:35)
    at Mqtt.connect (C:\Users\markrad\node_modules\node-red-contrib-azure-iot-hub\node_modules\azure-iot-device-mqtt\lib\mqtt.js:38:14)
    at Client.open (C:\Users\markrad\node_modules\node-red-contrib-azure-iot-hub\node_modules\azure-iot-device\lib\client.js:232:21)
    at Client.<anonymous> (C:\Users\markrad\node_modules\node-red-contrib-azure-iot-hub\node_modules\azure-iot-device\lib\client.js:192:14)
    at Mqtt.<anonymous> (C:\Users\markrad\node_modules\node-red-contrib-azure-iot-hub\node_modules\azure-iot-device-mqtt\lib\mqtt.js:137:7)
    at Store.close (C:\Users\markrad\node_modules\node-red-contrib-azure-iot-hub\node_modules\mqtt\lib\store.js:104:5)
    at C:\Users\markrad\node_modules\node-red-contrib-azure-iot-hub\node_modules\mqtt\lib\client.js:521:26
    at Store.close (C:\Users\markrad\node_modules\node-red-contrib-azure-iot-hub\node_modules\mqtt\lib\store.js:104:5)
    at Immediate.closeStores [as _onImmediate] (C:\Users\markrad\node_modules\node-red-contrib-azure-iot-hub\node_modules\mqtt\lib\client.js:520:24)
    at runCallback (timers.js:791:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)

I started this flow at 10:12 so you can see that it failed at almost exactly 45 minutes.

By the way, the easy circumvention to this is to switch to AMQP. I've not had any problems using that protocol.

[Edit] I have confirmed that, in my instance anyway, it crashes exactly 45 minutes after the connection was made.

20 Sep 13:05:31 - [info] [azureiothub:Azure IoT Hub] Connected to Azure IoT Hub.
.
.
.
20 Sep 13:50:31 - TypeError: this.mqttprovider.connect is not a function

Mark Radbourne MSFT

LeonardAB commented 5 years ago

Having the same issue here. In my case it is around 1 hour.

18 Dec 12:18:59 - [error] [azureiothub:Azure IoT Hub] Error while trying to send message:Error: client disconnecting
18 Dec 12:18:59 - [metric] {"level":99,"nodeid":"f74fc8a2.4c2658","event":"node.function.duration","msgid":"9fee3fc7.21ba4","value":5.71,"timestamp":1545103139299}
18 Dec 12:18:59 - [red] Uncaught Exception:
18 Dec 12:18:59 - TypeError: this.mqttprovider.connect is not a function
    at Mqtt.connect (C:\Users\Administrator\.node-red\node_modules\azure-iot-mqtt-base\lib\mqtt.js:71:35)
    at Mqtt.connect (C:\Users\Administrator\.node-red\node_modules\azure-iot-device-mqtt\lib\mqtt.js:38:14)
    at Client.open (C:\Users\Administrator\.node-red\node_modules\azure-iot-device\lib\client.js:232:21)
    at Client.<anonymous> (C:\Users\Administrator\.node-red\node_modules\azure-iot-device\lib\client.js:192:14)
    at Mqtt.<anonymous> (C:\Users\Administrator\.node-red\node_modules\azure-iot-device-mqtt\lib\mqtt.js:137:7)
    at Store.close (C:\Users\Administrator\.node-red\node_modules\mqtt\lib\store.js:104:5)
    at C:\Users\Administrator\.node-red\node_modules\mqtt\lib\client.js:521:26
    at Store.close (C:\Users\Administrator\.node-red\node_modules\mqtt\lib\store.js:104:5)
    at Immediate.closeStores (C:\Users\Administrator\.node-red\node_modules\mqtt\lib\client.js:520:24)
    at runCallback (timers.js:706:11)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
stokes776 commented 4 years ago

I seem to be having this issues as well, any resolution other than switching to AMQP as mentioned?

VictorStela commented 4 years ago

Hello guys,

I'm facing the same problem. Do you have any suggestion?

Regards.

rupeshshet commented 4 years ago

Any Suggestion?