socket-mode: a transient invalid_auth while reconnecting stops auto-reconnect permanently (no event emitted)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- backend, networking
Research direction
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.
Written by the indexing model from the issue text.
Description
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).
- Dominant language
- TypeScript
- Stars
- 3.4k
- Forks
- 693
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 67
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from slackapi/node-slack-sdk
-
auto-triage-skip enhancement pkg:web-api
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
slackapi/node-slack-sdk#2607 · 2 comments · 2 reactions ·
Maintainers usually reply within 1 day
-
`SlackListsItem FieldMessage.message` type does not match API response shapePossibly taken @AjTheSpidey claimed this 201 days ago. Openarea:typescript auto-triage-skip bug pkg:web-api
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
slackapi/node-slack-sdk#2598 · 2 comments ·
Maintainers usually reply within 1 day
-
Missing TypeScript response type for files.uploadV2Possibly taken @Yshuro claimed this 5 days ago. Openarea:typescript auto-triage-skip bug pkg:web-api
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
slackapi/node-slack-sdk#2459 · 2 comments ·
Maintainers usually reply within 1 day
-
Docs/types: document `broadcast_delete` on chat.delete (undo reply_broadcast)Possibly taken A pull request linked to this issue is open or already merged. Openarea:typescript enhancement pkg:web-api semver:patch
Difficulty 5/5 Over a week Newbie friendliness 25/100
slackapi/node-slack-sdk#2815 · 1 comment ·
Maintainers usually reply within 1 day
-
auto-triage-skip enhancement pkg:web-api server-side-issue
Difficulty 3/5 1-2 days Newbie friendliness 48/100
slackapi/node-slack-sdk#2540 · 7 comments ·
Maintainers usually reply within 1 day
All issues in slackapi/node-slack-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
melgarafael/DeskcommCRM#5614 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 76/100
slackapi/slack-health-score#253 ·
Maintainers usually reply within 1 day
-
feature needs triage site
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
owid/owid-grapher#8019 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
simstudioai/sim#10710 ·
Maintainers usually reply within 1 day
-
via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day