Skip to content

SocketModeClient still fails to automatically reconnect when apps.connections.open API returns an error code #1495

@seratch

Description

@seratch

As reported at slackapi/bolt-js#1428 (comment), there is still a pattern that SocketModeClient's auto-reconnection does not work. See the repro steps below for details.

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/rtm-api
  • @slack/webhooks
  • @slack/oauth
  • @slack/socket-mode
  • I don't know

Reproducible in:

The Slack SDK version

any version including 1.3.0

Node.js runtime version

any version

OS info

any

Steps to reproduce:

Copied from slackapi/bolt-js#1428 (comment)

[INFO] A pong wasn't received from the server before the timeout of 5000ms!
[INFO] Reconnecting to Slack ...
[INFO] Going to establish a new connection to Slack ...

[ERROR] Failed to send a message as the client is not ready
[ERROR] An unhandled error occurred while Bolt processed (type: event_callback, error: Error: Failed to send a WebSocket message as the client is not ready)
[ERROR] Failed to send a message as the client is not ready
[ERROR] An unhandled error occurred while Bolt processed (type: event_callback, error: Error: Failed to send a WebSocket message as the client is not ready)

[ERROR] Faled to retrieve a new WSS URL for reconnection (error: Error: An API error occurred: internal_error)
[WARNING] Failed to start a Socket Mode connection (error: An API error occurred: internal_error)

And then endless loop of:

[ERROR] Failed to send a message as the client is not ready
[ERROR] An unhandled error occurred while Bolt processed (type: event_callback, error: Error: Failed to send a WebSocket message as the client is not ready)

Looking into similar occurrences, it is usually able to reconnect, so I think what caused the problem is:

Faled to retrieve a new WSS URL for reconnection
Failed to start a Socket Mode connection

Expected result:

The SocketModeClient automatically reconnects when the server-side started working again.

Actual result:

The reconnection does not happen.

Metadata

Metadata

Assignees

Labels

bugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedpkg:socket-modeapplies to `@slack/socket-mode`

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions