Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket-mode:SocketModeClient:0 Received "disconnect" (reason: too_many_websockets) message - will attempt reconnect #2238

Closed
ropiDK opened this issue Sep 6, 2024 · 3 comments
Labels
duplicate An issue for the same purpose already exists, and a link is in the comments

Comments

@ropiDK
Copy link

ropiDK commented Sep 6, 2024

(Filling out the following with as much detail as you can provide will help us answer your question sooner.)

@slack/bolt version

"@slack/bolt": "^3.19.0"

Your App and Receiver Configuration

    token: process.env.SLACK_BOT_TOKEN,
    appToken: process.env.SLACK_APP_TOKEN,
    socketMode: true,
    logLevel: LogLevel.DEBUG, 
    scopes: [
        'commands',
        'chat:write',
        'chat:write.public',
        'channels:read',
        'channels:history',
        'groups:history',
        'im:history',
        'app_mentions:read',
    ],
});

Node.js runtime version

v20.16.0

Steps to reproduce:

  1. npm start
  2. error too_many_websockets
  3. already create new app level token but still cannot resolved

Expected result:

App Running

Actual result:

socket-mode:SocketModeClient:0 Received a message on the WebSocket: {"type":"disconnect","reason":"too_many_websockets","debug_info":{"host":"applink-10"}}
[DEBUG]  socket-mode:SocketModeClient:0 Received "disconnect" (reason: too_many_websockets) message - will attempt reconnect
/Users/ropi/app-slack/node_modules/finity/lib/core/StateMachine.js:76
      throw new Error('Unhandled event \'' + event + '\' in state \'' + this.currentState + '\'.');
            ^

Error: Unhandled event 'server explicit disconnect' in state 'connecting'.
    at StateMachine.handleUnhandledEvent (/Users/ropi/app-slack/node_modules/finity/lib/core/StateMachine.js:76:13)
    at /Users/ropi/app-slack/node_modules/finity/lib/core/HierarchicalStateMachine.js:79:33
    at TaskScheduler.execute (/Users/ropi/app-slack/node_modules/finity/lib/core/TaskScheduler.js:29:7)
    at TaskScheduler.enqueue (/Users/ropi/app-slack/node_modules/finity/lib/core/TaskScheduler.js:19:12)
    at HierarchicalStateMachine.handle (/Users/ropi/app-slack/node_modules/finity/lib/core/HierarchicalStateMachine.js:72:24)
    at SocketModeClient.onWebSocketMessage (/Users/ropi/app-slack/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/SocketModeClient.js:608:31)
    at WebSocket.onMessage (/Users/ropi/app-slack/node_modules/@slack/bolt/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (node:events:519:28)
@seratch seratch added duplicate An issue for the same purpose already exists, and a link is in the comments and removed untriaged labels Sep 6, 2024
@seratch
Copy link
Member

seratch commented Sep 6, 2024

Thanks for taking the time to write and we're sorry for the disruption. Please check #2225 for updates.

@seratch seratch closed this as completed Sep 6, 2024
@ropiDK
Copy link
Author

ropiDK commented Sep 6, 2024

the issue still on investigation right? i got this issue about few days ago... createing new app level token cannot resolve the problem

@filmaj
Copy link
Contributor

filmaj commented Sep 6, 2024

@ropiDK it is not in investigation. It is a design fault with socket-mode v1.x. socket-mode v2 fixes the issue. There is a bolt v4 release candidate available for use that uses socket-mode v2. You can try using that instead.

However, please pay close attention to the underlying reason for why the Slack server asked your app to reconnect:

{"type":"disconnect","reason":"too_many_websockets"

For some reason, your app is trying to initiate more than the maximum allowed 10 concurrent socket mode connections. Please see my comment in the issue @seratch mentioned here for details: #2225 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate An issue for the same purpose already exists, and a link is in the comments
Projects
None yet
Development

No branches or pull requests

3 participants