0

The following function in Node.js, run well from my computer, bet return error when run from a web server. (I tried to add a host parameter, but it didn't solve the problem).

import axios from "axios";

export async function loadCities(_, res) {
    const cities = await axios
        .get(
            `https://boardsgenerator.cbs.gov.il/Handlers/WebParts/YishuvimHandler.ashx?dataMode=Yeshuv&filters={"Years":"2021"}&language=Hebrew&mode=GridData&pageNumber=-1`
        )
        .catch((err) => {res.send(err)});
    res.send({ cities});
}

The error message:

{
  "message": "connect ETIMEDOUT 147.237.248.213:443",
  "name": "Error",
  "stack": "Error: connect ETIMEDOUT 147.237.248.213:443\n    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)",
  "config": {
    "transitional": {
      "silentJSONParsing": true,
      "forcedJSONParsing": true,
      "clarifyTimeoutError": false
    },
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 0,
    "xsrfCookieName": "XSRF-TOKEN",
    "xsrfHeaderName": "X-XSRF-TOKEN",
    "maxContentLength": -1,
    "maxBodyLength": -1,
    "env": {},
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "User-Agent": "axios/0.27.2"
    },
    "method": "get",
    "url": "https://boardsgenerator.cbs.gov.il/Handlers/WebParts/YishuvimHandler.ashx?dataMode=Yeshuv&filters={\"Years\":\"2021\"}&language=Hebrew&mode=GridData&pageNumber=-1"
  },
  "code": "ETIMEDOUT",
  "status": null
}
Y.S.
  • 157
  • 1
  • 11
  • Does this answer your question? [What could cause "connect ETIMEDOUT" error when the URL is working in browser?](https://stackoverflow.com/questions/33350604/what-could-cause-connect-etimedout-error-when-the-url-is-working-in-browser) – Alexxino Jun 12 '23 at 12:10
  • Thanks @Alexxino I tried the solutions written there before I wrote the question. Unfortunately it didn't help. – Y.S. Jun 12 '23 at 12:43

0 Answers0