I have tried to deploy the very simple node-red flow to send a message using MQTT to Azure. Unfortunately it crashes node-red every time.
I'm running NodeRed on a Raspberry Pi 3:
16 May 11:29:19 - [info] Node-RED version: v0.18.4
16 May 11:29:19 - [info] Node.js version: v8.11.1
16 May 11:29:19 - [info] Linux 4.14.34-v7+ arm LE
Been trying both of these node libraries:
https://github.com/Azure/azure-iot-sdk-node/tree/master/device/node-red https://github.com/rasavant-ms/node-red-contrib-azure/tree/master/iot-hub
Node Red Log:
Connection string :HostName=learning-hub.azure-devices.net;DeviceId=undefined;SharedAccessKey=undefined
16 May 11:16:52 - [error] [azureiothub:Azure IoT Hub] Could not connect: Connection refused: Not authorized
16 May 11:16:52 - [info] [azureiothub:Azure IoT Hub] Connected to Azure IoT Hub.
16 May 11:16:52 - [red] Uncaught Exception:
16 May 11:16:52 - TypeError: Cannot read property 'on' of undefined
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool..
This is my simple flow:
And the information in the nodes:
Azure IoT Hub
DTU Smart Library Azure
{
"deviceID": "SensorTag-D2",
"SAK": "<Primary-Key>",
"Protocol": "mqtt",
"Data": {
"Light": "25"
}
}