# Node.js: “Error: connect ETIMEDOUT” / “read ETIMEDOUT”

> Error: connect ETIMEDOUT or read ETIMEDOUT in Node.js. Nothing answered: a firewall or IP allowlist, a wrong port, IPv6 attempts, or a dropped connection.

Canonical: https://app369.com/fix/node-etimedout/
Last updated: 2026-11-08

A request, database client or npm install fails with Error: connect ETIMEDOUT 203.0.113.10:5432, read ETIMEDOUT, or an AggregateError listing several ETIMEDOUT attempts. The connection attempt got no answer in time. Unlike ECONNREFUSED, no server said no; the packets were dropped somewhere on the way.

**Short answer**

Check which kind it is. connect ETIMEDOUT means the connection was never set up: the host or port is wrong, a firewall drops the traffic, or a cloud database only accepts allowlisted IP addresses. Test the port from the same machine with nc -vz host port. read ETIMEDOUT means an open connection went silent, often an idle connection dropped by a load balancer or NAT. An AggregateError with one ETIMEDOUT per address means every address Node.js tried (IPv6 and IPv4) timed out; if the host works from elsewhere, a slow network or broken IPv6 is the usual cause, so raise the attempt timeout.

## **Why the connection timed out, and the fix**

1. 01 ### **connect ETIMEDOUT: a firewall, allowlist or wrong port**
  > “ETIMEDOUT (Operation timed out): A connect or send request failed because the connected party did not properly respond after a period of time.” [**Node.js, Errors: common system errors**](https://nodejs.org/api/errors.html) Managed databases (Postgres, MySQL, Redis, MongoDB Atlas) and private servers usually drop traffic from addresses that are not allowlisted, and a cloud firewall or security group does the same. A wrong port on a firewalled host looks identical. Test the exact host and port from the machine that fails, then allow that machine’s outbound IP in the provider’s network settings.```
nc -vz db.example.com 5432
# "succeeded" = reachable; a long wait then "timed out" = dropped on the way
# Windows: Test-NetConnection db.example.com -Port 5432
curl -s https://api.ipify.org   # the outbound IP to allowlist
```
2. 02 ### **AggregateError: several ETIMEDOUT attempts**
  > “The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the autoSelectFamily option.” [**Node.js, net: socket.connect() options**](https://nodejs.org/api/net.html) Node.js 20 and newer try each address of a hostname (IPv6 and IPv4) in turn and give each attempt 250 milliseconds by default. On a slow or high-latency network every attempt can time out, and the error lists them all. Give each attempt more time, or, when IPv6 is broken on that network, try IPv4 first with --dns-result-order=ipv4first.```
// in code, before the first connection
require('node:net').setDefaultAutoSelectFamilyAttemptTimeout(1000);

// or from the command line
node --network-family-autoselection-attempt-timeout=1000 server.js
```
3. 03 ### **read ETIMEDOUT: an open connection went silent** The connection worked, then the other side stopped answering. Load balancers, NAT gateways and serverless platforms drop idle connections without telling either end, so the next request on a pooled connection times out. Keep idle timeouts in your client shorter than the server’s, and retry requests that are safe to repeat.
4. 04 ### **Set your own timeouts so it fails fast**
  > “The timeout is the number of milliseconds before the request times out.” [**Axios, Request config: timeout**](https://axios-http.com/docs/req_config) An ETIMEDOUT from the operating system can take a long time to arrive. Set a timeout in the client so a dead host fails quickly with a clear error: the timeout option on http.request, timeout in Axios, or AbortSignal.timeout() with fetch. With http.request, the timeout option only emits a timeout event, so add a handler that calls req.destroy().```
const res = await fetch(url, { signal: AbortSignal.timeout(10_000) });

// Axios
axios.get(url, { timeout: 10_000 });

// http.request
const req = http.request(url, { timeout: 10_000 });
req.on('timeout', () => req.destroy(new Error('Request timed out')));
```

Checked against the vendor’s docs on November 8, 2026: [Node.js: Errors (common system errors)](https://nodejs.org/api/errors.html); [Node.js: net (autoSelectFamily)](https://nodejs.org/api/net.html); [Node.js: http.request() timeout](https://nodejs.org/api/http.html); [Axios: Request config](https://axios-http.com/docs/req_config).

## **Rather hand it over?**

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

- [from $450**App Fix Ticket**One reproducible bug in an existing mobile or web app, diagnosed and fixed.**See scope and start**](https://app369.com/fixed-price/flutter-firebase-bug-fix/)
- [from $450**AI-Built App Rescue**A Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.****No issues worth fixing, no charge.**** If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.**See scope and start**](https://app369.com/fixed-price/ai-app-rescue/)

Related: [**ECONNREFUSED: connection refused**](https://app369.com/fix/econnrefused-connection-refused/) · [**Node.js ECONNRESET (“socket hang up”)**](https://app369.com/fix/node-econnreset/) · [**Axios “Network Error”**](https://app369.com/fix/axios-network-error/) · [**“self-signed certificate in certificate chain”**](https://app369.com/fix/node-self-signed-certificate-in-chain/)

Questions

## **More on this error**

<details>

<summary>**What is the difference between ETIMEDOUT and ECONNREFUSED? **+</summary>

ECONNREFUSED is a fast, explicit no: the host answered, but nothing listens on that port. ETIMEDOUT is silence: the packets were dropped, usually by a firewall, an allowlist or a host that is down.

</details>

<details>

<summary>**npm install fails with ETIMEDOUT. What now? **+</summary>

npm could not reach the registry. On a company network, configure npm’s proxy settings or ask IT which proxy to use; elsewhere, check your connection and retry. A stuck VPN is a common cause.

</details>

<details>

<summary>**Can you fix it for me? **+</summary>

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

</details>

A different error?

## **Describe it and get a written quote**

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.

[**Describe your problem **→](https://app369.com/contact/) [**All fixes**](https://app369.com/fix/)