HTTP requests to healthcheck.io

Hi

I am trying to send a simple GET request to healthchecks.io in the format they give as an example “https://hc-ping.com/8ed9d26b-d62c-4fd6-999b-xxxxxxxx”. This works fine from a browser returning OK and reseting the watchdog but I am unable to do the same from NODERED. I always get no response from server. There was a similar post a while back but the answer just showed a PNG with inject, http and debug nodes but no example flow. I have tried inserting the part after the / as a msg.payload string, set a content header etc. but same result. I am completely lost and would appreciate a little guidance.

Thanks

I use healthchecks.io in node-red and it works fine.
Could you share the part of flow

Hi

Thanks for coming back. I have tried various combinations but because of the simplicity of sending direct from a web browser I thought these two might work.

[
    {
        "id": "8bb861c6a507698c",
        "type": "http request",
        "z": "ac27bf149efe6406",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "https://hc-ping.com/51300254-381b-44ee-9c4e-29e01c380b3d",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 630,
        "y": 160,
        "wires": [
            [
                "276153679da9c25e"
            ]
        ]
    },
    {
        "id": "248f86e261215dd4",
        "type": "inject",
        "z": "ac27bf149efe6406",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 410,
        "y": 160,
        "wires": [
            [
                "8bb861c6a507698c"
            ]
        ]
    },
    {
        "id": "276153679da9c25e",
        "type": "debug",
        "z": "ac27bf149efe6406",
        "name": "debug 7",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 880,
        "y": 160,
        "wires": []
    },
    {
        "id": "69766e62f8a0c766",
        "type": "http request",
        "z": "ac27bf149efe6406",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "body",
        "url": "https://hc-ping.com/",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 630,
        "y": 240,
        "wires": [
            [
                "a205ebec0137f159"
            ]
        ]
    },
    {
        "id": "116c52df95024e61",
        "type": "inject",
        "z": "ac27bf149efe6406",
        "name": "payload",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "51300254-381b-44ee-9c4e-29e01c380b3d",
        "payloadType": "str",
        "x": 410,
        "y": 240,
        "wires": [
            [
                "69766e62f8a0c766"
            ]
        ]
    },
    {
        "id": "a205ebec0137f159",
        "type": "debug",
        "z": "ac27bf149efe6406",
        "name": "debug 8",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 880,
        "y": 240,
        "wires": []
    }
]

I then tried various other combinations but it was all guesswork as I not found a good tutorial on http request format using nodered nodes.

Both you example flows work for me.

This suggest that you environment has the issue.

Please tell us more about you node-red environment and any error the http request node is returning.

Hi

Thanks for trying that, I can see that your ping went through and reset the watchdog.

Pi 4 running Bookworm Nodered installed from the script. There is another flow that accesses the Sesibio(heat pump control) API that works fine as does the Pushover API. If I change the url to google.com I see the page come back allbeit with status code 400. Change back to health check and no reponse from server displayed on node with following in debug.

_msgid: "b302810b90ce0d48"
payload: "RequestError : http://hc-ping.com/8ed9d26b-d62c-4fd6-999b-7a07ea0b5f8a HTTP/1.0"
statusCode: "ETIMEDOUT"

Cheers

Hi

Thanks for trying that, I can see that your ping went through and reset the watchdog.

Pi 4 running Bookworm Nodered installed from the script. There is another flow that accesses the Sesibio(heat pump control) API that works fine as does the Pushover API. If I change the url to google.com I see the page come back allbeit with status code 400. Change back to health check and no reponse from server displayed on node with following in debug.

_msgid: "b302810b90ce0d48"
payload: "RequestError : http://hc-ping.com/8ed9d26b-d62c-4fd6-999b-7a07ea0b5f8a HTTP/1.0"
statusCode: "ETIMEDOUT"

Cheers

Different Pi, copied my flow from the post above in case the url copied from the healthcheck site contained some odd characters, imported flow and same errors. Web browser and curl both return OK using identical url and other API’s functioning normally.

Really not sure what else to try.

From the pi can you ping hc-ping.com?

If you install node-red-node-ping can it ping the url?

Hi Colin

If i enter https://hc-ping.com as the target in the ping node it returns false.

If I curl from the exec node it returns ok and resets the watch dog.

If i ping from the terminal on the mac I am accessing nodered on (if that is in anyway relevant) I get cannot resolve https://hc-ping.com: Unknown host

I am relatively new to this and kind of working in the dark.

Thanks

I think you may have been asking if I can ping from SSH access to the pi, I get;

ping: https://hc-ping.com: Name or service not known

That is very strange. If ping cannot do a DNS lookup then I don't see how curl from an exec node can work. Are you sure those results are consistent? The only way I can see that can happen is if there is an intermittent problem with DNS lookup. Or there is a typo of some sort in your commands.

[Edit] You should be using ping hc-ping.com. Don't include https on the front. Is that the problem with the ping node too?

Hi Colin

I think it must be my error in the HTTP request but I posted my flow earlier and it worked for E1cid.

This is from a clean install of bookworm on a pi3. clean install of node red and the only flow.

Curl resets watchdog returns OK.

Ping now seems valid after I removed the HTTPS://.

HTTP request node still returns error, payload: "RequestError : http://hc-ping.com/51300254-381b-44ee-9c4e-29e01c380b3d"

statusCode: "ETIMEDOUT"

[
    {
        "id": "8347cfddcf19088f",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "254c4867da3dfd1f",
        "type": "http request",
        "z": "8347cfddcf19088f",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "hc-ping.com/51300254-381b-44ee-9c4e-29e01c380b3d",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 410,
        "y": 100,
        "wires": [
            [
                "47a18cb83f97bf4c"
            ]
        ]
    },
    {
        "id": "83859db7291e1ec5",
        "type": "inject",
        "z": "8347cfddcf19088f",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 100,
        "wires": [
            [
                "254c4867da3dfd1f"
            ]
        ]
    },
    {
        "id": "67e9cc1015d11e26",
        "type": "inject",
        "z": "8347cfddcf19088f",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "hc-ping.com/8ed9d26b-d62c-4fd6-999b-7a07ea0b5f8a",
        "payloadType": "str",
        "x": 150,
        "y": 160,
        "wires": [
            [
                "be4f644016ec2eaa"
            ]
        ]
    },
    {
        "id": "47a18cb83f97bf4c",
        "type": "debug",
        "z": "8347cfddcf19088f",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 100,
        "wires": []
    },
    {
        "id": "893fccc4e8092134",
        "type": "debug",
        "z": "8347cfddcf19088f",
        "name": "debug 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 160,
        "wires": []
    },
    {
        "id": "03e8a0f2913a468e",
        "type": "debug",
        "z": "8347cfddcf19088f",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 220,
        "wires": []
    },
    {
        "id": "be4f644016ec2eaa",
        "type": "exec",
        "z": "8347cfddcf19088f",
        "command": "curl",
        "addpay": "payload",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 410,
        "y": 160,
        "wires": [
            [
                "893fccc4e8092134"
            ],
            [],
            []
        ]
    },
    {
        "id": "c81790101a4d2135",
        "type": "ping",
        "z": "8347cfddcf19088f",
        "protocol": "Automatic",
        "mode": "timed",
        "name": "",
        "host": "hc-ping.com",
        "timer": "20",
        "inputs": 0,
        "x": 150,
        "y": 220,
        "wires": [
            [
                "03e8a0f2913a468e"
            ]
        ]
    },
    {
        "id": "bd6a061e01306be2",
        "type": "global-config",
        "env": [],
        "modules": {
            "node-red-node-ping": "0.3.3"
        }
    }
]

The URL’s are valid and currently working from browser or curl.

Not aware of any other network issues.

Thanks for your assistance.

Looks like this has cropped up before, may have to use the exec node and curl.

https://discourse.nodered.org/t/http-request-node-different-behaviour-on-nr-v3-1-vs-v4/96100