Variables with a null value in HTTP Request

Hello!

I am trying to retrieve a variable with a null value from a FunctionItem node, however, the variable is not displayed to me in the subsequent HTTP Request node.

I realize that this only with variables with null value, but I want to redeem them anyway, when these variables contain null value, I need to send null in the request.

How do I solve this problem?

Regards,

@guilhermeagirardi Welcome to the community.

Just tested it and you are right it seems like a bug.

@jan can be replicated with the example below.

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "items[0].json.variable = null;\nreturn items;"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "https://webhook.site/49dfc658-d5d6-4a06-8da5-79ae1b65340d",
        "options": {},
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "value",
              "value": "={{$node[\"Function\"].data[\"variable\"]}}"
            }
          ]
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Thanks! Interesting. Will add it to my To-Do list to check it out.

1 Like

Fix from @airmoi got merged. Will be released with the next version.

Fix got released with [email protected]

You mean after this version for nul output we get null word? :sleepy:

Sorry do not understand. But should not make a difference for you. It should only solve a bug that before did error when “null” got returned.

1 Like