Unable to save the second Customising config nodes in Subflows

Node-RED 4.02
Node v20.15.1

I'm very excited about the "Customising config nodes in Subflows" feature that was added in version 4.0, but it seems I've run into a problem.

In the subflow, I can't use the second environment config nodes to save. This problem is very reproducible.

[
    {
        "id": "e54169906b92fd0f",
        "type": "subflow",
        "name": "Subflow 3",
        "info": "",
        "category": "",
        "in": [],
        "out": [],
        "env": [
            {
                "name": "one",
                "type": "mqtt-broker",
                "value": "",
                "ui": {
                    "type": "conf-types"
                }
            },
            {
                "name": "tow",
                "type": "mqtt-broker",
                "value": "",
                "ui": {
                    "type": "conf-types"
                }
            }
        ],
        "meta": {},
        "color": "#DDAA99"
    },
    {
        "id": "4a7c38167d88f367",
        "type": "mqtt out",
        "z": "e54169906b92fd0f",
        "name": "",
        "topic": "",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "${one}",
        "x": 130,
        "y": 120,
        "wires": []
    }
]

I don't understand exactly what is not working for you. Please give detailed instructions on how to replicate the problem.

I think you have a miss understanding of how to use the env config var.
You would still set all your mqtt configs in the mqtt config node.
Then in the subflow properties env config you set the env var to a config type and select the mqtt config.
Then you can select which mqtt config (server) to use when you add a new instance of the subflow.

The [env] one show it the mqtt config, but they are not editable there as the are just marker to show that there are subflow envs set using the mqtt config.

@Colin
@E1cid

Thanks for your reply. I am not a native English speaker, so some of my answers may not be clear.

I want to use [env] two as the mqtt configuration of this mqtt node in the subflow, but when I close the editor, it returns to [env] one .

My subflow will use multiple mqtt configurations, so I used the subflow envs set. If there are other implementation methods, you can also tell me.

I see you are right, it is not possible to set it to to anything other than the first one. I will submit a bug report and post the link back here.

It looks like only one env config is accept per type of config node.
[edit to clarify]

See Unable to select which subflow config property to use when more than one configured · Issue #4863 · node-red/node-red · GitHub

1 Like

Did you mean only one per subflow?

No, per type of config node. Or i would of said per subflow.

OK, understood, only on env config is accept per type of config node (that isn't actually what you wrote originally, hence my confusion).