Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

socket-mode: a transient invalid_auth while reconnecting stops auto-reconnect permanently (no event emitted)

Abierto
#2,791 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
75/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
node.js, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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-mode 2.0.7 (through @slack/bolt 4.6). The same code is in 3.1.0.
  • Node 24.22
Code path
  1. The close listener calls this.delayReconnectAttempt(this.start) and doesn't handle the returned promise.
  2. start() calls retrieveWSSURL(). It classifies invalid_auth, not_authed, account_inactive, etc., and every RequestError and HTTPError, as unrecoverable, then rethrows instead of retrying.
  3. delayReconnectAttempt() runs cb.apply(this).then(res) with no rejection handler. The rejection is unhandled and the client never tries again. It emits no disconnected or 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.Disconnected or an error), 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).

Lenguaje dominante
TypeScript
Estrellas
3.4k
Forks
691
Merge medio
1 d 2 h
PR fusionados (30 d)
19

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de slackapi/node-slack-sdk

Todos los issues de slackapi/node-slack-sdk

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.