Imported subflow does not work

Hello sometimes when I export and import subflow to my instance it just doesn't work.

I Even connected the Debug node straight to the input of the subflow and nothing is passing to it.
I have tried to delete the subflow and add it once again to the flow - doesn't work

The only workaround is the delete the subflow and create the new one, but that takes some time when i have environment variables.

It's not the first case but I cannot identify what causes this to happen. Also other subflow imported work it's totally random.

[
    {
        "id": "126a89ab.0cfde6",
        "type": "subflow",
        "name": "Whatsapp twilio text message (3)",
        "info": "This subflow takes:\n\nmsg.to - with whatsapp number,\nmsg.text - message payload",
        "category": "",
        "in": [
            {
                "x": 340,
                "y": 100,
                "wires": [
                    {
                        "id": "989ab836.9b4008"
                    }
                ]
            }
        ],
        "out": [],
        "env": [],
        "color": "#C7E9C0",
        "icon": "font-awesome/fa-cloud-upload"
    },
    {
        "id": "989ab836.9b4008",
        "type": "debug",
        "z": "126a89ab.0cfde6",
        "name": "test",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 530,
        "y": 160,
        "wires": []
    },
    {
        "id": "762134e9.ffd03c",
        "type": "subflow:126a89ab.0cfde6",
        "z": "f38e8a4b.28f618",
        "name": "Whatsapp Out",
        "env": [
            {
                "name": "twilio_auth_token",
                "type": "cred"
            }
        ],
        "x": 640,
        "y": 2980,
        "wires": []
    },
    {
        "id": "b9b726aa.f73b48",
        "type": "inject",
        "z": "f38e8a4b.28f618",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 400,
        "y": 2980,
        "wires": [
            [
                "762134e9.ffd03c"
            ]
        ]
    }
]

GIF with problem: https://imgur.com/a/UwVWs5t

NODE-RED version: [1.2.6]
The same problem persist on other browsers.

If you look at the exported flow you will see that for the usage of the subflow it shows a property

        "env": [
            {
                "name": "twilio_auth_token",
                "type": "cred"
            }
        ],

which I believe means that the use of the subflow is trying to pass across an env property of type credentials, however, the subflow does not define any such property. If you edit that out when importing the flow then it works ok.
Possibly a problem caused by deleting a property from the subflow after creating a use of the subflow, or something like that. Maybe related to it being a credentials property that has been deleted.
Over to @dceejay possibly to comment further.
when the flow is deployed it gives this error in the log:

TypeError: Cannot read property 'twilio_auth_token' of undefined
    at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Subflow.js:142:59
    at Array.forEach (<anonymous>)
    at new Subflow (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Subflow.js:133:38)
    at Object.createSubflow [as create] (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Subflow.js:508:12)
    at Flow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:205:55)
    at start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:345:33)
    at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:210:21

It would probably be a good idea to tell us which versions of node-red and nodejs you are using.

Node-red: 1.2.6
Nodejs: "12.19.0"

This was reported a couple of days ago - https://github.com/node-red/node-red/issues/2783

It has been fixed in git and will be in 1.2.7 - although we don't yet have a release date for that.

1 Like

Thank and sorry I did a re-post but i couldn't find the answer.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.