nanomq / nanomq

An ultra-lightweight and blazing-fast Messaging broker/bus for IoT edge & SDV

Home Page:https://nanomq.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error connection with MQTT V5.0 : Cannot parse property code type

amcharhal opened this issue · comments

Describe the bug

Error occurs while trying to connect the client using MQTT on Node.js. Using the properties requestResponseInformation and requestProblemInformation.

Expected behavior

The client should connect with no errors and send back the responseTopic on the packet when a client is subscribed to some topic.

Actual Behavior

Connection error occurs. Cannot parse the property code type, resulting in the client being unable to connect

To Reproduce
Try to connect with the broker using protocolVersion: 5 and the following properties:

{
requestResponseInformation: true,
requestProblemInformation: true
}

Environment Details

NanoMQ version: Latest version
Same issue on Windows, Linux, and Docker image latest versions
Client SDK

Node.js version: v21.5.0
SDK MQTT version: 5.3.5 Link to npm package

Additional context

const clientOptions: mqtt.IClientOptions = {
keepalive: 60,
protocolVersion: 5,
properties: {
requestResponseInformation: true,
requestProblemInformation: true,
},
};
mqtt.connect("mqtt://XXX.XXX.XXX.XXX", clientOptions)

RESULT

Error: Cannot parse property code type

the same sdk client code works fine with online free broker EMQX https://www.emqx.com/en/mqtt/public-mqtt5-broker

nanomq by default reply with response information if u set
requestResponseInformation: true,
requestProblemInformation: true,

This is sth different with EMQX But still compliant with protocol standard.
Seems like nodejs sdk fail to parse the property type 0×19. Tested with mqttx before, Will go deeper if you have a working client. I am noobie on web development...

Hello, @JaylinYu

Thank you for your response. Here is an example of MQTT code in Node.js. You can replicate the issue by following these steps:

Install Node.js version >= 16.
After unzipping mqtt-example.zip, navigate to the mqtt-example folder and run the command npm install.
Open index.js and replace brokerurl with your broker's IP address.
Run the command node index.js.

mqtt-example.zip

Hi @amcharhal, thank you for reporting issue.
This turns out to be a regression bug of mine. Sorry to break the MQTTV5 compliant.
Now it has been fixed nanomq/NanoNNG#857.

Will publish a bug fix ver soon.

Hello, @JaylinYu , Thank you for your prompt attention to this matter

we shall add a CI case regarding MQTTV5 encode/decode @OdyWayne

@JaylinYu Hello, have you already fixed this bug or not yet? is there is a release version please
@OdyWayne

@JaylinYu Hello, have you already fixed this bug or not yet? is there is a release version please @OdyWayne

Yup, that's why it has been closed.
Try 0.21.8. appreciate any feedback