Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

ECONNRESET from `fetch` still crashes netlify-cli

未关闭
#7,952 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
nodejs, typescript
领域
cli

调研方向

未指定源文件或测试。使用提供的本地 reset server 重现 ECONNRESET 情况,然后跟踪 netlify-cli 的 fetch 错误处理,并为此故障添加覆盖;当 dev server 能够在不崩溃的情况下处理 reset 时即表示完成。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
TypeScript
星标
1.9k
派生
480
平均合并
1 天 15 小时
30 天内合并 PR
66

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

netlify/cli 的其他 Issue

查看 netlify/cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。