Skip to content

[BUG] ECONNREFUSED on GitHub Actions with Node 18 #20784

@Merott

Description

@Merott

Context:

  • Playwright Version: 1.30.0
  • Operating System: GitHub Actions with ubuntu-latest
  • Node.js version: 18.14.0
  • Browser: All

Running Playwright on GitHub CI with Node 18.14.0 I kept running into ECONNREFUSED errors and finally a timeout:

Describe the bug

2023-02-09T15:42:40.206Z pw:webserver HTTP GET: http://localhost:8888/
2023-02-09T15:42:40.207Z pw:webserver Error while checking if http://localhost:8888/ is available: connect ECONNREFUSED ::1:8888
2023-02-09T15:42:40.207Z pw:webserver Waiting 1000ms

Error: Timed out waiting 60000ms from config.webServer.

I managed to fix it after lots of googling and finding this: node-fetch/node-fetch#1624

Apparently, "there was a breaking change in node v17 that changed the default IP resolving. ip6 is preferred by default," and because of it, trying to access http://localhost:8888 wouldn't work while explicitly using http://127.0.0.1:8888 would.

The other option would be to override the default DNS behaviour to prioritise IPv4, which I did by putting this at the top of the Playwright config file:

import dns from 'node:dns'
dns.setDefaultResultOrder('ipv4first')

I'm not sure if this is necessarily a Playwright issue, in which case you can close this issue right away. At the very least it'll be helpful for others (and future me) running into the same problem.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions