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

Receiving multiple events for simple messages in web socket mode #2188

Closed
SuperZooper3 opened this issue Aug 7, 2024 · 2 comments
Closed
Labels
needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info question M-T: User needs support to use the project

Comments

@SuperZooper3
Copy link

SuperZooper3 commented Aug 7, 2024

@slack/bolt version

"@slack/bolt": "^3.3.0", running in typescript

Your App and Receiver Configuration

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

Node.js runtime version

Not quite sure, but it should be modern. Probably 22

Issue

My slack bot responds multiple times to a single event. It follows a consistent pattern of responding, then Slackbot tells me that it failed to dispatch, and then it runs again. On my backend, I actually get three events, once of which is marked as a retry, the other two marked as first tries, but all for the exact same message.

Looking in my logs, the event notifications say:

{[...],"type":"events_api","accepts_response_payload":false,"retry_attempt":1,"retry_reason":"timeout"}

This happens not only for general messages (where I have a matching string), but also for slash commands, which also follow the same pattern. I also explicitly make sure to ack those commands (see example below).

app.command(leaderboardCommand, async ({ command, ack }) => {
      await ack();
      await leaderboardHandler(app, command);
    });

The only thing I'm thinking could be that I have a commonly used message event trigger, but only at most once a minute. I'm on socket mode, and this bot is only added to one workspace.

I'm running on K8S on GKE (not thought AWS Lambda like seems to be an issue in lots of other people's questions about this like #2031 or #914). This issue only starts occurring after about a couple of weeks of it running.

I've tried looking at #1727, but that didn't seem like it would help in my case.

In the meantime, I'll just keep restarting the bot periodically, but this is pretty annoying to my end users, so I would like to fix it.

Thanks for any help!

@filmaj filmaj added question M-T: User needs support to use the project 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 Aug 7, 2024
@filmaj
Copy link
Contributor

filmaj commented Aug 7, 2024

I have not encountered this myself. The fact that the events you are receiving are retries is suspect; this tells me Slack's backend is not receiving your ack() calls.

Can you confirm in your DEBUG logs that the ack() is being sent over WebSockets and there is no issue? A typical app when calling ack() would see DEBUG logs of the form (the below is acking a slash command event):

[DEBUG]  socket-mode:SocketModeClient:0 Calling ack() - type: slash_commands, envelope_id: b3cac969-eb05-4db1-80d1-d0270b076bbc, data: undefined
[DEBUG]  socket-mode:SocketModeClient:0 send() method was called (WebSocket state: OPEN)
[DEBUG]  socket-mode:SlackWebSocket:1 isActive(): websocket ready state is OPEN
[DEBUG]  socket-mode:SocketModeClient:0 Sending a WebSocket message: {"envelope_id":"b3cac969-eb05-4db1-80d1-d0270b076bbc","payload":{}}

@filmaj
Copy link
Contributor

filmaj commented Sep 15, 2024

Closing as we have not heard from the original poster. Feel free to re-open if you have new information to share.

@filmaj filmaj closed this as completed Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info question M-T: User needs support to use the project
Projects
None yet
Development

No branches or pull requests

2 participants