socket-mode: a transient invalid_auth while reconnecting stops auto-reconnect permanently (no event emitted)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- backend, networking
調査の方向性
Locate SocketModeClient and follow close → delayReconnectAttempt() → start() → retrieveWSSURL() to see where the rejected promise stops reconnection. Check the existing Socket Mode tests for initial-start and reconnect behavior, then add coverage for a transient invalid_auth during auto-reconnect and verify that retries continue or a disconnection/error event is emitted.
索引モデルが issue の本文から書いたものです。
説明
Description
After a Socket Mode connection closes, SocketModeClient stops reconnecting for good if a single apps.connections.open call returns invalid_auth (or another error the client treats as unrecoverable). The app stops receiving events, and nothing tells it so.
Slack sometimes returns invalid_auth temporarily during its own incidents. That makes a short Slack incident a permanent outage for the app until its process is restarted.
What happened
On 2026-10-22 at 16:08:41 UTC, during a period when Slack was returning HTTP 503s, two Socket Mode clients (two workspaces, two separate app tokens) reconnected at the same moment. Both got:
[ERROR] socket-mode:SocketModeClient:0 Failed to retrieve a new WSS URL (error: Error: An API error occurred: invalid_auth)
[ERROR] socket-mode:SocketModeClient:1 Failed to retrieve a new WSS URL (error: Error: An API error occurred: invalid_auth)
unhandled rejection {"code":"slack_webapi_platform_error","data":{"ok":false,"error":"invalid_auth"}}
After that, neither client made another attempt. No events arrived for 1h20. Restarting the process with the same tokens reconnected both clients immediately, so the tokens were never invalid.
Reproducible in
@slack/socket-mode2.0.7 (through@slack/bolt4.6). The same code is in 3.1.0.- Node 24.22
Code path
- The
closelistener callsthis.delayReconnectAttempt(this.start)and doesn't handle the returned promise. start()callsretrieveWSSURL(). It classifiesinvalid_auth,not_authed,account_inactive, etc., and everyRequestErrorandHTTPError, as unrecoverable, then rethrows instead of retrying.delayReconnectAttempt()runscb.apply(this).then(res)with no rejection handler. The rejection is unhandled and the client never tries again. It emits nodisconnectedor error event, so the app can't detect the dead state.
The unrecoverable classification makes sense for the first start(), where the caller awaits it and can act on a bad token. It doesn't make sense on the auto-reconnect path, where no caller can see the error.
Suggested fix (any one of these)
- While auto-reconnect is on, keep retrying unrecoverable errors in the reconnect path with backoff. A revoked token then shows up as repeated errors instead of silence.
- Or emit an event when auto-reconnect gives up (
State.Disconnectedor anerror), so apps can restart the client. - In either case, handle the promise in
delayReconnectAttempt().
Related: #2656 (another unhandled rejection from the same delayReconnectAttempt path, triggered by a different race).
- 主要言語
- TypeScript
- スター
- 3.4k
- フォーク
- 691
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 19
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
slackapi/node-slack-sdk のほかの issue
-
ThreadBroadcastMessageEvent is missing `bot_id`対応中かも @sean0407 が 12 日前に担当しました。 オープンuntriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
slackapi/node-slack-sdk#2766 ·
メンテナーはふだん 1 日以内に返信
-
SocketModeClient crashes on Events API payloads without an inner event対応中かも @kyungyeon-byun-imweb-me が 25 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
slackapi/node-slack-sdk#2753 ·
メンテナーはふだん 1 日以内に返信
-
Support assistant.search.* APIs対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンauto-triage-skip enhancement pkg:web-api
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
slackapi/node-slack-sdk#2607 · コメント 2 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
`SlackListsItem FieldMessage.message` type does not match API response shape対応中かも @AjTheSpidey が 163 日前に担当しました。 オープンarea:typescript auto-triage-skip bug pkg:web-api
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
slackapi/node-slack-sdk#2598 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Missing TypeScript response type for files.uploadV2対応中かも @dajiaohuang が 30 日前に担当しました。 オープンarea:typescript auto-triage-skip bug pkg:web-api
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
slackapi/node-slack-sdk#2459 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
slackapi/node-slack-sdk の issue をすべて見る
似ている issue
-
type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
0️⃣ phase/new
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
microsoft/playwright#43640 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100