Node-red V3 - node.warn is not working, function node not working?

Hi there!
I installed yesterday on a fresh Debian 11 node-red V3.
After setting up some new flows I am noticing that function nodes seem not to work for me. E.g. node.warn() produces no output. A code line like msg.payload = "haha"; does not change the msg output from that function node....

What can cause such issues?

The installer I used is this one: https://github.com/node-red/linux-installers

Thanks for any pointers!
Cheers
JR

Hi @bs-eng

Forgive what may be an obvious question, but you are definitely deploying the changes you made to the node after each edit? It isn't enough to just close the edit dialog, you have to click the deploy button in the top right of the editor.

Can you export and paste here a simple flow consisting of an Inject node, a function node and a debug node demonstrating the two problems please?

no worries about silly questions:

  • yes, the flow is being deployed completely.
  • a sample flow I am currently using is this:
[
    {
        "id": "b0285e4ba29bbba5",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "4702a9d0940d57a7",
        "type": "ui_form",
        "z": "b0285e4ba29bbba5",
        "name": "",
        "label": "",
        "group": "480d904da74a968f",
        "order": 1,
        "width": 0,
        "height": 0,
        "options": [
            {
                "label": "AUS",
                "value": "AUS",
                "type": "number",
                "required": true,
                "rows": null
            },
            {
                "label": "50°C",
                "value": "T50",
                "type": "number",
                "required": false,
                "rows": null
            },
            {
                "label": "90°C",
                "value": "T90",
                "type": "number",
                "required": false,
                "rows": null
            },
            {
                "label": "100°C",
                "value": "T100",
                "type": "number",
                "required": false,
                "rows": null
            },
            {
                "label": "150°C",
                "value": "T150",
                "type": "number",
                "required": false,
                "rows": null
            },
            {
                "label": "200°C",
                "value": "T200",
                "type": "number",
                "required": false,
                "rows": null
            },
            {
                "label": "250°C",
                "value": "T250",
                "type": "number",
                "required": false,
                "rows": null
            }
        ],
        "formValue": {
            "AUS": "",
            "T50": "",
            "T90": "",
            "T100": "",
            "T150": "",
            "T200": "",
            "T250": ""
        },
        "payload": "",
        "submit": "submit",
        "cancel": "cancel",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": "",
        "className": "",
        "x": 470,
        "y": 200,
        "wires": [
            [
                "51f47c499c06da51",
                "be8805b49421213c"
            ]
        ]
    },
    {
        "id": "51f47c499c06da51",
        "type": "debug",
        "z": "b0285e4ba29bbba5",
        "name": "debug 266",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 910,
        "y": 200,
        "wires": []
    },
    {
        "id": "0ca96fb20ee030d7",
        "type": "inject",
        "z": "b0285e4ba29bbba5",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"AUS\":0,\"T50\":45,\"T90\":null,\"T100\":95,\"T150\":null,\"T180\":null,\"T200\":null,\"T250\":null,\"T270\":null}",
        "payloadType": "json",
        "x": 330,
        "y": 200,
        "wires": [
            [
                "4702a9d0940d57a7",
                "17debf73338ff8bd"
            ]
        ]
    },
    {
        "id": "17debf73338ff8bd",
        "type": "debug",
        "z": "b0285e4ba29bbba5",
        "name": "debug 263",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 490,
        "y": 240,
        "wires": []
    },
    {
        "id": "152c8ccda00f41b3",
        "type": "function",
        "z": "b0285e4ba29bbba5",
        "name": "calc",
        "func": "msg.payload = \"haha\";\nnode.warn(\"my warning\");\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 670,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "be8805b49421213c",
        "type": "debug",
        "z": "b0285e4ba29bbba5",
        "name": "debug 264",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 690,
        "y": 240,
        "wires": []
    },
    {
        "id": "480d904da74a968f",
        "type": "ui_group",
        "name": "Winkelmesser",
        "tab": "4585cd3260b0875d",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "4585cd3260b0875d",
        "type": "ui_tab",
        "name": "Retro-S",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

Your function node is not connected to the wire, try moving it.

nothing in the wires array

1 Like

OMG
Yes, that did it.
Thanks for looking into it!

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