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

Frequent disconnects in socket mode #2113

Closed
stephenkalnoske-sans opened this issue May 7, 2024 · 9 comments
Closed

Frequent disconnects in socket mode #2113

stephenkalnoske-sans opened this issue May 7, 2024 · 9 comments
Assignees
Labels
auto-triage-skip Prevent this issue from being closed due to lack of activity question M-T: User needs support to use the project

Comments

@stephenkalnoske-sans
Copy link

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

@slack/bolt

3.18.0

const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN
});

Node.js runtime version

20.11.1

Steps to reproduce:

(Share the commands to run, source code, and project settings)

  1. Start server according to example docs
  2. Server receives events just fine...for a while
  3. Server disconnects with error

Expected result:

Server stays connected indefinitely

Actual result:

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 (.../node_modules/finity/lib/core/StateMachine.js:76:13)
at .../node_modules/finity/lib/core/HierarchicalStateMachine.js:79:33

@hello-ashleyintech hello-ashleyintech self-assigned this May 7, 2024
@hello-ashleyintech hello-ashleyintech added needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info and removed untriaged labels May 7, 2024
@hello-ashleyintech
Copy link
Contributor

Hi, @stephenkalnoske-sans! Thank you for submitting this issue! 🙇

To be able to better understand the issue - how often does this occur? Are you noticing a maximum threshold of time that the connection lasts before you receive this error?

@stephenkalnoske-sans
Copy link
Author

Hi @hello-ashleyintech! I haven't been able to pinpoint exactly when this occurs. But it is daily. I'll start the service in the morning and by the end of the day it is disconnected with that error.

@filmaj
Copy link
Contributor

filmaj commented May 7, 2024

Looks like the same issue as this one in the underlying socket mode package: slackapi/node-slack-sdk#1787

@stephenkalnoske-sans can you confirm the exact version of @slack/socket-mode you are using in your bolt app? It is a dependency of bolt, you can check it by running npm ls | grep socket-mode.

@stephenkalnoske-sans
Copy link
Author

Yep! v1.3.5

@filmaj
Copy link
Contributor

filmaj commented May 7, 2024

Has this been happening more recently? I'm trying to identify where this issue was introduced, whether it is new or whether this behaviour has always existed.

Do you see it if you lock socket-mode to v1.3.4?
Another alternative is to try @slack/bolt@4.0.0-rc.1, which uses the new socket-mode 2.0, which ditches the 1.x line of socket mode (which used a problematic design of 2 alternating socket connections pumping transitions into a single state machine).

@stephenkalnoske-sans
Copy link
Author

@filmaj I only installed bolt last week so didn't have any other releases but the most current one. I have the 4.0 release candidate running now and will watch it to see if I get any more disconnects. Previously it would happen every day so will know soon. Thanks for your help!

@filmaj
Copy link
Contributor

filmaj commented May 7, 2024

Awesome, please feel free to at-mention me with any issues that crop up. Appreciate any feedback you provide on the release candidate!

@filmaj filmaj added question M-T: User needs support to use the project auto-triage-skip Prevent this issue from being closed due to lack of activity and removed needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info labels May 7, 2024
@filmaj filmaj self-assigned this May 7, 2024
@stephenkalnoske-sans
Copy link
Author

Hi @filmaj, definitely seems more stable now. I'll close this out. RC1 is running fine as well. Thanks again!

@filmaj
Copy link
Contributor

filmaj commented May 8, 2024

Ok sounds good! I'd recommend you lock to rc1 (and not allow for floating versions via ~ or ^) as rc2 and so on may introduce breaking changes as we inch closer to a brand new bolt v4 major version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-triage-skip Prevent this issue from being closed due to lack of activity question M-T: User needs support to use the project
Projects
None yet
Development

No branches or pull requests

3 participants