Repository navigation
Conversation
When a Socket Mode event arrives while the socket is closing or reconnecting, ack() rejects with slack_socket_mode_no_reply_received_error. SocketModeClient emits slack_event without awaiting its listeners, so the rejection is unhandled and Node exits. We saw this in production during graceful shutdowns: chat.shutdown() disconnects the socket, an event lands in that window, and the process dies before finishing its cleanup. Both slack_event listeners, in startSocketMode() and runSocketModeListener(), now run their work through handleSocketEventSafely(), which logs "Error handling socket mode event". Slack redelivers an event that wasn't acknowledged, so it isn't lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Otto Hilska <otto@swarmia.com>
Contributor
|
@mutru is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
mutru
marked this pull request as ready for review
November 16, 2026 23:01
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
If a Socket Mode event arrives while the socket is closing or reconnecting,
ack()rejects withslack_socket_mode_no_reply_received_error.SocketModeClientemitsslack_eventwithout awaiting its listeners, so the rejection is unhandled and Node exits.We hit this during graceful shutdowns after deployment.
chat.shutdown()disconnects the socket, an event lands in that window, and the process crashes before it finishes its own cleanup:The new instance then got the event as a retry (
retry_reason: "timeout"), so the event wasn't lost; the process exit was the only harm. The same path can fire on any reconnect, not only at shutdown. Webhook mode isn't affected, since its acknowledgement is the HTTP response.Both
slack_eventlisteners, instartSocketMode()andrunSocketModeListener(), now run their work throughhandleSocketEventSafely(), which logsError handling socket mode eventwith the event type and error instead of rejecting.This follows the Discord adapter, whose Gateway
rawlistener has the same problem, since discord.js doesn't await listeners either:enqueueOrderedForward()catches the listener's work and logsFailed to forward Gateway event.Test plan
slack_eventhandler with anack()that rejects, and assert that it resolves and logs the error. Both fail without the fix.pnpm validatepasses, except theexample-nuxt-chatbuild, which fails locally withENAMETOOLONGin Nitro'snode_modulestraversal (a macOS path-length limit in my checkout, unrelated to this change). The other 30 build tasks pass.Checklist
git commit -s)pnpm validatepasses (except the localexample-nuxt-chatbuild noted above)🤖 Generated with Claude Code