Http request generates error - getaddrinfo EAI_AGAIN

Hi,

I am trying to access the questdb using HTTP nodes. I am working with get and post methods . While sending the http request , I am getting this error:

{
"status": "rejected",
"reason": {
"message": "getaddrinfo EAI_AGAIN time-series-db.localhost",

"name": "Error",
"stack": "Error: getaddrinfo EAI_AGAIN time-series-db.localhost at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)",
"code": "EAI_AGAIN"
}
}

time-series-db.localhost is the questdb url.

Could you please help in resolving this? Thank you.

Hey @Dhanya_V_Sagar,

Are you running n8n in a container and is the container able to resolve that hostname?

If the service you are connecting to is running on the host can you try using 172.17.0.1

Yes. N8n is in a container and is able to resolve the host name.
The questdb node is working fine and I am able to access Questdb. But I need to use http node in my workflow.

That is a bit odd, So the getaddrinfo EAI_AGAIN error tends to show up when the hostname being used can’t be resolved and tends to point to a network issue but the node working is really strange.

Have you tried using the IP address instead of the hostname? What version of n8n are you running as well?

1 Like

Hi again,

Thank you for the quick response.

Yes I tried and its not working . The Questdb node is working fine. But when I try to access questdb data using http node, its throwing the error.

N8n Version: 0.141.1

Hi @Dhanya_V_Sagar, I am so sorry to hear you are running into trouble here. I quickly gave this a go and can query QuestDB just fine using the HTTP Request node in a workflow like this:

{
  "nodes": [
    {
      "parameters": {
        "url": "https://demo.questdb.io/exec",
        "options": {},
        "queryParametersUi": {
          "parameter": [
            {
              "name": "query",
              "value": "pos latest by id where geo6 within(#wtq);"
            }
          ]
        }
      },
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    }
  ],
  "connections": {}
}

So as mentioned by @jon the first thing that comes to my mind here would indeed be an issue with your docker/networking setup. Are you using the QuestDB node on the same n8n instance as the HTTP Request node? What error exactly were you getting when using the IP address of your QuestDB server in the HTTP Request node?

Can you query your QuestDB from a shell within your n8n docker container (for example by first running apk add curl and then making a curl request such as curl 'https://demo.questdb.io/exec?query=pos%20latest%20by%20id%20where%20geo6%20within(%23wtq)%3B' where https://demo.questdb.io is the URL of your QuestDB server)?

1 Like

Thank you for the quick response. I am new to this and I am working on the suggestions you have given (using shell and checking the docker setup).

I have added my work flow below. Could you check if there is a mistake there?

{
  "name": "New Work",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        430,
        200
      ]
    },
    {
      "parameters": {
        "url": "https://time-series-db.localhost/exec",
        "options": {},
        "queryParametersUi": {
          "parameter": [
            {
              "name": "query",
              "value": "SELECT * FROM telemetry;"
            }
          ]
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        690,
        200
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": 16
}.

**When using the IP address of  QuestDB** server in the HTTP Request node I am getting the below response.

{

"status": "rejected",

"reason": {

"message": "connect ECONNREFUSED 172.19.0.9:80",

"name": "Error",

"stack": "Error: connect ECONNREFUSED 172.19.0.9:80 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)",

"code": "ECONNREFUSED"

}

}

Also I am using the QuestDB node on the same n8n instance as the HTTP Request node

The HTTP Request node is looking good to me - pretty much what I was doing in my example.

One thing worth pointing out is that QuestDB uses a number of different ports and for the HTTP Request node you’d need the one of the REST API. By default this would be 9000 but might differ in your setup (the ECONNREFUSED 172.19.0.9:80 error suggest you were querying port 80).

So my suggestions for the next steps here would be to verify you are querying the right port for QuestDB’s REST API and also make sure to try querying the REST API with plain http instead of https.

1 Like