Search code examples
node.jsazurevisual-studio-codeazure-iot-hubtelemetry

Azure IOT Hub: ReferenceError sending Telemetry Data 'Invalid transport configuration'


I'm working on the exercise (https://learn.microsoft.com/en-us/learn/modules/remotely-monitor-devices-with-azure-iot-hub/4-exercise-write-code-device-telemetry?pivots=vscode-node). As I test my code to send telemetry, I'm getting the following error.

\node_modules\azure-iot-mqtt-base\dist\mqtt_base.js:356
                    throw new ReferenceError('Invalid transport configuration');

Upon reviewing the code, I noticed a warning, while installing [email protected] library.

npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

Solution

  • IoT devices require a central hub, in our case the Azure IoT Hub to upload their data to and to retrieve new configurations updates from. IoT devices can choose between different transports for their connecting to IoT Hub as follows -

    • MQTT, MQTT over WebSockets
    • AMQP, AMQP over WebSockets
    • HTTPS

    Authentication is done using a symmetric key or X.509 certificates which can be either self-signed or signed by a CA. And IoT devices can send messages with a size of up to 256 KB. The message format can be text or binary.

    I checked them module you mentioned in your question but didn't found any exercise or workshop, so I'm not sure where you are getting the error.

    Try the Send telemetry from an IoT Plug and Play device to Azure IoT Hub exercise.