partysocket: a URL provider that rejects with undefined gives an unhandled rejection and stops the reconnection
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 62/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- networking
調査の方向性
バグは packages/partysocket/src/ws.ts(585〜588行目付近)の _connect() にある .catch() 内にあり、拒否された URL または protocols プロバイダーから err.message を読み取っています。issue の再現手順を partysocket 1.3.0 で実行し、TypeError と CONNECTING 状態での停止を確認してください。完了条件は、undefined または null で拒否するプロバイダーが error イベントを発行し、次の試行をスケジュールすること、unhandled rejection が発生しないこと、そして partysocket のテストスイートが通ることです。
索引モデルが issue の本文から書いたものです。
説明
The .catch() of _connect() reads err.message. When the URL provider (or the protocols provider) rejects with undefined or null, for example with reject() and no argument, that line throws a TypeError inside the .catch(). The result is an unhandled rejection, no error event, and no next attempt: the socket stays in CONNECTING.
Repro
The packages: [email protected]. Install them with npm i [email protected].
// npm install, then: node repro.ts (Node.js 22.18 or later runs TypeScript directly)
import WebSocket from "partysocket/ws";
process.on("unhandledRejection", (reason) => {
console.log("unhandledRejection:", String(reason));
});
let calls = 0;
const ws = new WebSocket(
() => {
calls++;
// for example, reject() in a token fetcher
return Promise.reject(undefined);
},
undefined,
{ minReconnectionDelay: 50, maxReconnectionDelay: 50 },
);
let errors = 0;
ws.addEventListener("error", () => errors++);
setTimeout(() => {
console.log("provider calls in 500 ms:", calls);
console.log("error events:", errors);
console.log("readyState:", ws.readyState);
ws.close();
}, 500);
node repro.ts (Node.js 22.18 or later runs TypeScript directly)
Actual
unhandledRejection: TypeError: Cannot read properties of undefined (reading 'message')
provider calls in 500 ms: 1
error events: 0
readyState: 0
Expected
An error event, and a new attempt after the reconnection delay, as for a provider that rejects with an Error. No unhandled rejection.
A fix
A fix with a new test is on the branch fix/partysocket-provider-rejects-nullish of my fork, at 54a3d36. On a GitHub Actions runner, the new test fails before the change and passes after it, and the whole partysocket suite passes. This repository accepts pull requests only from collaborators, so I did not open a pull request. I can open one if you allow it, or you can take the commit.
I found this with AI assistance (Claude) during a review of WebSocket client libraries. The repro above was run with partysocket 1.3.0 on Node.js 24.22.2 on Linux (a GitHub Actions runner), and the output above is from that run. The fix was also prepared with AI assistance (Claude).
- 主要言語
- TypeScript
- スター
- 1.3k
- フォーク
- 86
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cloudflare/partykit のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
cloudflare/partykit#444 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
cloudflare/partykit#443 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
cloudflare/partykit#430 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
cloudflare/partykit#429 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
cloudflare/partykit#428 ·
cloudflare/partykit の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
steelbrain/node-ssh#487 ·
-
cli: `execCargoMetadata` decodes stdout per chunk, corrupting non-ASCII paths across pipe boundariesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
lingdojo/kana-dojo#34127 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
osmlab/name-suggestion-index#13104 ·
メンテナーはふだん 1 日以内に返信