# Getting \`ENETUNREACH\` and \`ETIMEDOUT\` errors when calling canister via agent-js

**URL:** <https://forum.dfinity.org/t/getting-enetunreach-and-etimedout-errors-when-calling-canister-via-agent-js/26348>\
**Category:** Developers\
**Created:** [January 9, 2024, 10:35am UTC](https://forum.dfinity.org/t/getting-enetunreach-and-etimedout-errors-when-calling-canister-via-agent-js/26348 "2024-01-09T10:35:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZenVoich](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/zenvoich/32/5969_2.png) [@ZenVoich](https://forum.dfinity.org/u/ZenVoich)\
**Post date:** [January 9, 2024, 10:35am UTC](https://forum.dfinity.org/t/getting-enetunreach-and-etimedout-errors-when-calling-canister-via-agent-js/26348/1 "2024-01-09T10:35:07Z")

</div>

Tried with agent-js 0.19.3 and 0.20.2  
Node.js v20.10.0  
canister id: oknww-riaaa-aaaam-qaf6a-cai  
API host: [https://icp-api.io](https://icp-api.io)

Sometimes the request works fine, but most of the time I get these errors:

```auto
node:internal/deps/undici/undici:11730
    Error.captureStackTrace(err, this);
          ^

TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11730:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async HttpAgent._requestAndRetry (/home/zen/ic/mops/cli/node_modules/@dfinity/agent/lib/cjs/agent/http/index.js:265:26)
    at async HttpAgent.query (/home/zen/ic/mops/cli/node_modules/@dfinity/agent/lib/cjs/agent/http/index.js:312:26)
    at async caller (/home/zen/ic/mops/cli/node_modules/@dfinity/agent/lib/cjs/actor.js:181:28)
    at async search (file:///home/zen/ic/mops/cli/dist/commands/search.js:6:34)
    at async Command.<anonymous> (file:///home/zen/ic/mops/cli/dist/cli.js:165:5) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at internalConnectMultiple (node:net:1177:5)
      at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
      at listOnTimeout (node:internal/timers:575:11)
      at process.processTimers (node:internal/timers:514:7) {
    code: 'ETIMEDOUT',
    [errors]: [
      Error: connect ETIMEDOUT 193.118.63.170:443
          at createConnectionError (node:net:1634:14)
          at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
          at listOnTimeout (node:internal/timers:575:11)
          at process.processTimers (node:internal/timers:514:7) {
        errno: -110,
        code: 'ETIMEDOUT',
        syscall: 'connect',
        address: '193.118.63.170',
        port: 443
      },
      Error: connect ENETUNREACH 2a0b:21c0:b002:2:5000:afff:fee6:a836:443 - Local (:::0)
          at internalConnectMultiple (node:net:1176:40)
          at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
          at listOnTimeout (node:internal/timers:575:11)
          at process.processTimers (node:internal/timers:514:7) {
        errno: -101,
        code: 'ENETUNREACH',
        syscall: 'connect',
        address: '2a0b:21c0:b002:2:5000:afff:fee6:a836',
        port: 443
      }
    ]
  }
}

Node.js v20.10.0

```

sometimes I get this error

```auto
Caught exception while attempting to make request:
  TypeError: fetch failed
  Retrying request.
Caught exception while attempting to make request:
  TypeError: fetch failed
  Retrying request.
Caught exception while attempting to make request:
  TypeError: fetch failed
  Retrying request.
Caught exception while attempting to make request:
  TypeError: fetch failed
  Retrying request.
Caught exception while attempting to make request:
  TypeError: fetch failed
  Retrying request.
Caught exception while attempting to make request:
  TypeError: fetch failed
  Retrying request.
node:internal/deps/undici/undici:11730
    Error.captureStackTrace(err, this);
          ^

TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11730:11)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at listOnTimeout (node:internal/timers:540:9)
    at process.processTimers (node:internal/timers:514:7)
    at async HttpAgent._requestAndRetry (/home/zen/ic/mops/cli/node_modules/@dfinity/agent/lib/cjs/agent/http/index.js:357:24)
    at async HttpAgent._requestAndRetry (/home/zen/ic/mops/cli/node_modules/@dfinity/agent/lib/cjs/agent/http/index.js:364:24)
    at async HttpAgent._requestAndRetry (/home/zen/ic/mops/cli/node_modules/@dfinity/agent/lib/cjs/agent/http/index.js:364:24)
    at async HttpAgent._requestAndRetry (/home/zen/ic/mops/cli/node_modules/@dfinity/agent/lib/cjs/agent/http/index.js:364:24)
    at async makeQuery (/home/zen/ic/mops/cli/node_modules/@dfinity/agent/lib/cjs/agent/http/index.js:416:30) {
  cause: AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at internalConnectMultiple (node:net:1177:5)
      at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
      at listOnTimeout (node:internal/timers:575:11)
      at process.processTimers (node:internal/timers:514:7) {
    code: 'ETIMEDOUT',
    [errors]: [
      Error: connect ETIMEDOUT 193.118.63.169:443
          at createConnectionError (node:net:1634:14)
          at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
          at listOnTimeout (node:internal/timers:575:11)
          at process.processTimers (node:internal/timers:514:7) {
        errno: -110,
        code: 'ETIMEDOUT',
        syscall: 'connect',
        address: '193.118.63.169',
        port: 443
      },
      Error: connect ENETUNREACH 2a0b:21c0:b002:2:5000:edff:fe0d:98de:443 - Local (:::0)
          at internalConnectMultiple (node:net:1176:40)
          at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
          at listOnTimeout (node:internal/timers:575:11)
          at process.processTimers (node:internal/timers:514:7) {
        errno: -101,
        code: 'ENETUNREACH',
        syscall: 'connect',
        address: '2a0b:21c0:b002:2:5000:edff:fe0d:98de',
        port: 443
      }
    ]
  }
}

Node.js v20.10.0

```

How to reproduce:

```auto
npx ic-mops search mo

```

---

<div class="post-metadata">

**Author:** ![ZenVoich](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/zenvoich/32/5969_2.png) [@ZenVoich](https://forum.dfinity.org/u/ZenVoich)\
**Post date:** [January 9, 2024, 10:53am UTC](https://forum.dfinity.org/t/getting-enetunreach-and-etimedout-errors-when-calling-canister-via-agent-js/26348/2 "2024-01-09T10:53:45Z")

</div>

Looks like it is not a node.js related issue - now I cannot open sites hosted on IC.

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/1/19af48f1d4121f506a0c20d47b6e6e603a1fda6b.png)

[https://dashboard.internetcomputer.org](https://dashboard.internetcomputer.org)

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/9/95d12f09ea7c82cfab8169d1ed6ef223729865b0.png)

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [January 9, 2024, 10:54am UTC](https://forum.dfinity.org/t/getting-enetunreach-and-etimedout-errors-when-calling-canister-via-agent-js/26348/3 "2024-01-09T10:54:48Z")

</div>

We’re investigating high load on the boundary nodes

---

<div class="post-metadata">

**Author:** ![rbole](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbole/32/1334_2.png) [@rbole](https://forum.dfinity.org/u/rbole)\
**Post date:** [January 9, 2024, 10:59am UTC](https://forum.dfinity.org/t/getting-enetunreach-and-etimedout-errors-when-calling-canister-via-agent-js/26348/4 "2024-01-09T10:59:15Z")

</div>

Is there an ongoing DDOS attack on the IC and all canisters are not reachable ?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [January 9, 2024, 11:09am UTC](https://forum.dfinity.org/t/getting-enetunreach-and-etimedout-errors-when-calling-canister-via-agent-js/26348/5 "2024-01-09T11:09:30Z")

</div>

> [@It seems that the IC network is not working properly](https://forum.dfinity.org/t/it-seems-that-the-ic-network-is-not-working-properly/26349/4):
>
> Hello everyone, yes, we are currently experiencing a surge in traffic that is causing the dashboard and other dapps hosted on the IC to load slowly. The IC is working as always, but the boundary nodes cannot keep up with the increased traffic and route all requests to the subnets. We are working on improving the performance and increasing capacity.
