How to increase the timeout time of http-request node

I am using the rdap api to get information using http-request node example: https://rdap.org/ip/192.168.1.199 it gives error timedout whereas when I use the same API in the browser it gives a proper JSON response can you help how to increase the timeout time for the HTTP-request node or is there any other way to do the same

Hi,
Welcome to the Forum,

Have you tried adding this property to the message sent to the http request node?

msg.requestTimeout = 60000 // 60s, increase as needed

yes i have tried this but it doesnt work

[
    {
        "id": "d002ca4ee8f478d9",
        "type": "inject",
        "z": "7b8b63bb9db2a79b",
        "name": "manual input",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            },
            {
                "p": "requestTimeout",
                "v": "60000",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 110,
        "y": 120,
        "wires": [
            [
                "8a72f0e34df03347"
            ]
        ]
    },
    {
        "id": "7ee5e50f0bb07b38",
        "type": "debug",
        "z": "7b8b63bb9db2a79b",
        "name": "debug 36",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 320,
        "y": 200,
        "wires": []
    },
    {
        "id": "8a72f0e34df03347",
        "type": "http request",
        "z": "7b8b63bb9db2a79b",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "https://rdap.org/ip/192.225.226.195",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 150,
        "y": 200,
        "wires": [
            [
                "7ee5e50f0bb07b38"
            ]
        ]
    }
] 

admin edit: wrapped code in code block to make it usable

**This is my flow and it gives a request timeout error and this https://rdap.org/ip/192.225.226.195 will give a response over the browser

Did you set the correct verb and URL on your request?

Did you try adding headers that match what the browser added (look at the browsers dev tools, network tab to see what your browser adds to a request)

Your flow works for me (without modification)

Does your node-red server have access to internet?
(by which I mean the computer/device/RPi where node-red is installed, not the browser from where you are accessing it)_

Is your Node-RED running in a container? (e.g. docker / LXC / HA plugin etc)

PS, since the response is JSON, you should select "parsed JSON object" for the return value

image

then you get an object that is far easier to grab values from (instead of a long string)

Thanks for the screenshot - but that does not answer any of the questions.

it has internet connection and my node-red is working on linux virtual-machine

Are you 100% certain the VM can contact the internet?

Install the node-red-node-ping node and try pinging rdap.org

also, what version of Node-RED and Node-JS is the VM running?

yes iam 100% sure it has internet connection. node-red v3.1.3 and nodejs version v20.10.0

Then I am at a loss - since (as demonstrated above) your flow works for me.

What does ping rdap.org return (executed INSIDE the VM and executed locally on the native OS)?

I would probably try Node V18 (thats what I am using)

Also, it might be an IPV4 / IPV6 thing - try disabling IPV6 on the VM (or enable IPV6 if currently disabled)

EDIT:
One other thought, there might be spam protection on the API - have you been hammering it?

@77raimanish have you found a solution for your problem?
I am having the same issue but in my native OS. Internet connection works incredibly well, but Node-Red cannot connect to internet. (As you showed in your HTTP request)

msg.requestTimeout = 60000 // 60s, increase as needed this thing worked for me

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