Skip to content

Conversation

@ElijahJunaid
Copy link

Fixes #7747 Part 2

Problem: Node.js 24.x triggers unhandled ECONNRESET errors at the socket level when the HTTP proxy attempts to connect to framework dev servers. The default HTTP agent's keepAlive behavior exacerbates these errors, causing the Netlify CLI proxy to crash when handling requests to the framework server.

Solution: Replaced the default HTTP agent with a custom agent that:
Disables keepAlive to prevent connection pooling issues that trigger ECONNRESET
Sets maxSockets: Infinity to avoid socket exhaustion
Wraps createConnection to add socket-level error handlers
Catches and destroys sockets on ECONNRESET before the error can crash the process
The custom agent is passed to httpProxy.createProxyServer() to ensure all proxy connections use the resilient socket handling.

Testing:
✅ Tested with Nuxt 4.x on Node.js 24.6.0 (previously crashed, now works)
✅ Verified proxy requests succeed without ECONNRESET crashes
✅ Maintains backward compatibility with earlier Node.js versions

@ElijahJunaid ElijahJunaid requested a review from a team as a code owner October 29, 2025 16:25
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

1 participant