Skip to content

[🐛 Bug]: v9: TypeError: fetch failed (ECONNREFUSED) #13553

@torbenkohlmeier

Description

@torbenkohlmeier

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.0.9

Node.js Version

18.20.4

Mode

WDIO Testrunner

Which capabilities are you using?

{
  'wdio:maxInstances': 1,
  'wdio:enforceWebDriverClassic': true,
  browserName: 'chrome',
  browserVersion: '123',
  'goog:chromeOptions': {
    args: ['--disable-http2', '--headless', '--disable-dev-shm-usage', '--disable-gpu', '--no-sandbox', '--disable-extensions', '--accept-lang=de'],
    prefs: {
      'intl.accept_languages': 'de-DE',
      'download.prompt_for_download': false,
      'download.directory_upgrade': true,
      'download.default_directory': pathToDownloadDirectory
    }
  },
  acceptInsecureCerts: true
}

What happened?

Sporadically, the following error occurs:

TypeError: fetch failed

error properties: Object({ cause: Error: connect ECONNREFUSED 127.0.0.1:62837 })
    at node:internal/deps/undici/undici:12618:11
Caused by: Error: connect ECONNREFUSED 127.0.0.1:62837
error properties: Object({ errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 62837 })
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at __node_internal_exceptionWithHostPort (node:internal/errors:671:12)
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

We have a large number of tests and I couldn't find a pattern which tests fail and which not. It seems to be completely random. I even ran the tests on different machines, the error occurs seemingly on any machine (at least Windows 10 and 11).

The error did not occur with webdriverio 8.

What is your expected behavior?

The error should not occur.

How to reproduce the bug.

I am not able to create a reproducible example since the error seems to occur completely randomly.

Relevant log output

TypeError: fetch failed

error properties: Object({ cause: Error: connect ECONNREFUSED 127.0.0.1:62837 })
    at node:internal/deps/undici/undici:12618:11
Caused by: Error: connect ECONNREFUSED 127.0.0.1:62837
error properties: Object({ errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 62837 })
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at __node_internal_exceptionWithHostPort (node:internal/errors:671:12)
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions