Skip to content

Undici throws a ConnectTimeoutError when there is no connection #1484

@mdmitry01

Description

@mdmitry01

Bug Description

If you try to send an HTTP request, but the DNS lookup for the requested domain name fails, Undici may throw a ConnectTimeoutError.

Reproducible By

I wrote a simple script which reproduces the issue

const { Pool } = require('undici')

const agent = new Pool('http://foobar.bar')

for (let i = 0; i < 500; i++) {
  agent.request({ method: 'GET', path: '/foobar' })
    .then(async ({ body }) => {
      for await (const data of body) {
        console.log('data', data.toString('utf8'))
      }
    })
    .catch(console.error)
}

I used [email protected]

Expected Behavior

I'd expect to get only errors which indicate that the DNS lookup has failed.

Logs & Screenshots

Kazam_screencast_00184.mp4

Environment

Ubuntu 20.04.4 LTS, Node v16.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions