Simple HTTP Request not working

Hi,

I have just started using Node-Red. I have build the simplest possible GET HTTP Request node and it's not working (TimeOut Error) :anguished:. When I type the same address in the browser or in Postman it works perfectly fine. I can't understand where the problem might be. Can someone help me with this please ?

Thanks

Welcome to the forum.

I do hope you realize no one but you yourself knows what calling that url is suppose to do. When asking a question it is a good idea to provide some background information and maybe include that portion of the flow that produces the error. Have you added debug node (set to display the complete msg object) to the HTTP request node? what does it show?

With out more info, how would anyone else knows what is going on??

Also what OS are you running on and how did you install node red? Is it a docker install, for example, which might mean you could not access that IP.

The url call is a ping/pong schema.

The flow is composed by an injector, a http request and a debug node, as follows:

[
    {
        "id": "b3f47bda83f326a8",
        "type": "tab",
        "label": "HTTP Request Test",
        "disabled": false,
        "info": ""
    },
    {
        "id": "dcd2b0ea0814e5e8",
        "type": "http request",
        "z": "b3f47bda83f326a8",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://192.168.1.163:5001/api/ping",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 290,
        "y": 340,
        "wires": [
            [
                "7c20a251eb64852b"
            ]
        ]
    },
    {
        "id": "7c20a251eb64852b",
        "type": "debug",
        "z": "b3f47bda83f326a8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 470,
        "y": 340,
        "wires": []
    },
    {
        "id": "6faf18fedc736079",
        "type": "inject",
        "z": "b3f47bda83f326a8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 110,
        "y": 340,
        "wires": [
            [
                "dcd2b0ea0814e5e8"
            ]
        ]
    }
]

The complete msg object of the debug node is the foollowing:

{"_msgid":"044cd8c07c89dae4","payload":"TimeoutError: Timeout awaiting 'request' for 120000ms : http://192.168.1.163:5001/api/ping","topic":"","statusCode":"ETIMEDOUT"}

The OS I'm using is Ubuntu and I did install Node-Red using the Node-Red Docker Image. Why I can't access that local IP form the docker install ? There is a way around that ?

Because docker installations don't give you access to system resources unless you allow it to. That is one of the purposes of using docker, so you can limit what it can do.

There are two ways round it. One is to setup the docker to allow access, which I don't know how to do. The other is to not use docker. Use the Ubuntu/Pi install script found at Running on Raspberry Pi : Node-RED

First though, can you confirm that if you enter open a browser and enter http://192.168.1.163:5001/api/ping that it does respond?

Hi Colin,

Yes, http://192.168.1.163:5001/api/ping does respond just fine.

I run multiple Docker containers and I usually do a port-forwarding when I want to communicate from outside a container to a container or vice-versa, which works usually fine.

I don't understand why in this case it's not working. I'm going to try to investigate the docker configuration and come back if I found something use-full.

Any way, glad to know that there is a Ubuntu instal script, I will keep it in mind as an alternative if I don't find my way out with Docker.

Thanks

You can try to use host_mode in docker if you want to get rid of docker networks...

@novski thanks, host_mode should solve my issue, it only works with Linux systems but this is not a problem in my case, but I prefer containers not to share my host network namespace.

The standard networking option bridge_mode should work mapping address/port combination between containers and host. With docker-compose I'm mapping 192.168.1.163:1880 (host) with 127.0.0.1:1880 (docker container).

If I can't isolate my container from my host network namespace, there is not much sense to me implementing a docker container, in that case I'd rather prefer running Node-Red without docker as @Colin proposed.

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