Skip to content

MQTT - Allow new user properties to be added via message even if other props are configured in node or broker #5435

Description

@colinl

Current Behavior

Using an MQTT Out node, if any MQTT 5 user properties are specified in the node then it should still be possible to add new properties using msg.userProperties. Currently this is not possible.

See #5360 for discussion as to whether this should be allowed. The conclusion was yes.

Expected Behavior

No response

Steps To Reproduce

No response

Example flow

paste your flow here

Environment

  • Node-RED version:
  • Node.js version:
  • npm version:
  • Platform/OS:
  • Browser:

Activity

  1. added this to the 5.0 milestone on Apr 2, 2026
  2. Steve-Mcl commented on Jul 13, 2026

    @Steve-Mcl
    Contributor

    To be clear (to refresh my mind and help implementor)

    After some discussion, it was agreed (or rather could not be argued against) that user properties set (statically) in the node should not prevent new/other properties from the msg object being added to the userProperties.

    In essence this means userProperties would be merged with static properties taking precidence.

    e.g.

    Node userPropertes       = `{ "p1": 1 }`
    msg.userPropertes        = `{ "p1": 5, "p2", 5 }`
    results in userPropertes = `{ "p1": 1, "p2", 5 }`
    

    @colinl @dceejay are we in agreement?

  3. knolleary commented on Jul 13, 2026

    @knolleary
    Member

    In this instance, it perhaps feels more useful to allow the msg provided properties to take precedence; you set a default in the node but allow it to be customised. I know that isn't how we handle top-level node properties, but when thinking about how this would actually be used, I think it makes sense here.

  4. colinl commented on Jul 13, 2026

    @colinl
    ContributorAuthor

    I agree, being able to override existing properties could be useful. I can't see any reason not to allow override as well as adding new ones.
    Should passing null for an existing one remove the property for that transaction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions