Skip to content

Conversation

@ElijahJunaid
Copy link

Fixes #7747 Part 1

Problem: Node.js 24.x throws unhandled ECONNRESET errors during port availability checks, causing Netlify CLI to crash when waiting for framework dev servers to become ready. The existing waitPort() library doesn't handle socket-level ECONNRESET errors that are common in Node.js 24.x.

Solution: Added checkPortWithRetry() function that:
Performs socket-level port checks with proper ECONNRESET error handling
Implements exponential backoff retry logic (up to 20 retries)
Detects IPv4 vs IPv6 to support detectFrameworkHost logic
Gracefully handles socket timeouts and connection failures
Replaced the single waitPort() call with checkPortWithRetry() to ensure framework server readiness checks survive ECONNRESET errors without crashing the CLI.

Testing:
✅ Tested with Nuxt 4.x on Node.js 24.6.0 (previously crashed, now works)
✅ Maintains backward compatibility with earlier Node.js versions
✅ Preserves existing warning/timeout behavior

@ElijahJunaid ElijahJunaid requested a review from a team as a code owner October 29, 2025 16:23
Copy link
Contributor

@VitaliyR VitaliyR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thanks for the PR!

I've checked the wait-port library and I agree that it crashes when ECONNRESET happens. They have even TODO there :)

What I'd suggest to do in the scope of this PR is to

  • Move this method to separate file like src/lib/wait-port.ts
  • Remove the wait-port library since it's being used only in that place
  • Fix tests as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ECONNRESET crash when using Netlify CLI with Node.js 24.x and Nuxt 4.x dev server

2 participants