Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

ECONNRESET from `fetch` still crashes netlify-cli

Aperta
#7,952 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
nodejs, typescript
Ambito
cli

Direzione di ricerca

Non viene indicato alcun file sorgente né alcun test. Riproduci il caso ECONNRESET con il server locale di reset fornito, quindi traccia la gestione degli errori di fetch in netlify-cli e aggiungi la copertura per questo errore; il lavoro è terminato quando il server di sviluppo gestisce il reset senza andare in crash.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type: bug
Describe the bug

I believe this is similar to #7747.

FetchError: request to http://localhost:8080/ failed, reason: connect ECONNRESET 127.0.0.1:8080
    at ClientRequest.<anonymous> (/home/pierre/code/hello/node_modules/node-fetch/lib/index.js:1501:11)
    at ClientRequest.emit (node:events:519:28)
    at emitErrorEvent (node:_http_client:107:11)
    at Socket.socketErrorListener (node:_http_client:574:5)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

  System:
    OS: Linux 6.17 Linux Mint 22.2 (Zara)
    CPU: (8) x64 Intel(R) Xeon(R) E-2134 CPU @ 3.50GHz
  Binaries:
    Node: 22.21.1 - ~/.local/share/mise/installs/node/22.21.1/bin/node
    Yarn: 1.22.22 - ~/.local/share/pnpm/yarn
    npm: 10.9.4 - ~/.local/share/mise/installs/node/22.21.1/bin/npm
Steps to reproduce

Start a local server that will reset the connection:

python3 -c "import socket,struct; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1); s.bind(('0.0.0.0', 8080)); s.listen(1); 
while True: c,_=s.accept(); c.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0)); c.close()"

Test:

$ curl localhost:8080
curl: (56) Recv failure: Connection reset by peer

Have this function:

function handler(event, context, callback) {
  fetch('http://localhost:8080')
    .then(reponse => response.json())
    .then(json => callback(null, {statusCode: 200, body: JSON.stringify({hello: 'world'}))
}

Then start the dev server with netlify-cli and get the error.

Configuration

No response

Environment
$ npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli
sh: 1: envinfo: not found
$ npx netlify-cli --version
netlify-cli/23.15.1 linux-x64 node-v22.21.1

$ node --version
v22.21.1
Lingua principale
TypeScript
Stelle
1.9k
Fork
480
Merge medio
1g 15h
PR unite (30g)
66

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di netlify/cli

Tutte le issue di netlify/cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.