slackapi / hubot-slack

Slack Developer Kit for Hubot
https://slack.dev/hubot-slack/
MIT License
2.3k stars 638 forks source link

Can not trigger listener sometimes. #641

Closed yihchu closed 2 years ago

yihchu commented 2 years ago

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

Requirements (place an x in each of the [ ])


Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

hubot-slack version: ^4.10.0

node version: v14.15.3

OS version(s): cenos7.9

Steps to reproduce:

  1. new a hubot
  2. add it into a slack channel
  3. modify 'example.coffee'
  4. start hubot

Expected result:

After send 'hello', it replies 'Hello World.' After send 'badger', it replies 'Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS'

Actual result:

Sometimes, it goes well, but sometimes, the same text can not trigger the listener. Please see the logs.

Attachments:

I send 'hello' and 'badger', sometimes it goes well, like this:

[Fri Jul 15 2022 10:21:30 GMT+0800 (中国标准时间)] DEBUG Message 'jokerr hello' matched regex //hello/i/; listener.options = { id: null }
[Fri Jul 15 2022 10:21:30 GMT+0800 (中国标准时间)] DEBUG Executing listener callback for Message 'jokerr hello'
[Fri Jul 15 2022 10:21:30 GMT+0800 (中国标准时间)] DEBUG SlackClient#send() room: D03PG99UQ7M, message: Hello World.
[Fri Jul 15 2022 10:21:38 GMT+0800 (中国标准时间)] DEBUG Received text message in channel: D03PG99UQ7M, from: W9Z9MFWHG (human)
[Fri Jul 15 2022 10:21:38 GMT+0800 (中国标准时间)] DEBUG Message 'jokerr badger' matched regex //badger/i/; listener.options = { id: null }
[Fri Jul 15 2022 10:21:38 GMT+0800 (中国标准时间)] DEBUG Executing listener callback for Message 'jokerr badger'
[Fri Jul 15 2022 10:21:38 GMT+0800 (中国标准时间)] DEBUG SlackClient#send() room: D03PG99UQ7M, message: Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS

But sometimes....

[Fri Jul 15 2022 10:17:34 GMT+0800 (中国标准时间)] DEBUG Received text message in channel: D03PG99UQ7M, from: W9Z9MFWHG (human)
[Fri Jul 15 2022 10:17:43 GMT+0800 (中国标准时间)] DEBUG Received file_shared message from: undefined, file_id: F03PP89C0BE
[Fri Jul 15 2022 10:17:43 GMT+0800 (中国标准时间)] DEBUG No listeners executed; falling back to catch-all

And here is the screenshot of slack

截屏2022-07-15 10 30 58
seratch commented 2 years ago

Hi @yihchu, thanks for asking the question.

DEBUG Received file_shared message from: undefined, file_id: F03PP89C0BE

This log line indicates the message has an attached file. Thus, this one cannot be part of your screenshot. Please check the channel history again. Also, even when a message has attached files, as long as your message text contains "badger", your listener can react to the message for sure.

yihchu commented 2 years ago

Hi @yihchu, thanks for asking the question.

DEBUG Received file_shared message from: undefined, file_id: F03PP89C0BE

This log line indicates the message has an attached file. Thus, this one cannot be part of your screenshot. Please check the channel history again. Also, even when a message has attached files, as long as your message text contains "badger", your listener can react to the message for sure.

Hi @seratch ,please check this. https://github.com/slackapi/hubot-slack/issues/642#issuecomment-1185183614

I reproduced, and I take a new screenshot and logs.

seratch commented 2 years ago

Hi @yihchu, I've checked your comment in #642 and tried to see the same situation on my end. However, my Hubot app does not miss any messages. Also, we do not see any outage / incident reports on the RTM API (= underlying WebSocket connectivity) at this moment.

The only possible cause that I can think of is that your Hubot app's WebSocket connection might be a bit unstable due to something specific to your network environment (or anything between Slack server and your Hubot app process). In this case, the Slack server-side could occasionally fail to send message events to your app.

To narrow the issue down, I would suggest trying to run the same app in a completely different setting (say, on a different cloud service) and see how it goes. If your situation persists regardless of where to run your Hubot app, something wrong may be happening to your workspace or Hubot app configuration. To resolve this, please contact our customer support team from either /feedback in your Slack workspace or https://my.slack.com/help/requests/new .

Lastly, if you don't have any particular reason to use Hubot, we highly recommend using a newer platform feature for new app development. Most of the things that Hubot w/ Slack adapter can be done with Bolt framework along with Socket Mode + Events API in a better way. Refer to the Getting Started Guide for learning how to use it.

I hope this was helpful to you and everything will work well for you soon.

yihchu commented 2 years ago

Hi @yihchu, I've checked your comment in #642 and tried to see the same situation on my end. However, my Hubot app does not miss any messages. Also, we do not see any outage / incident reports on the RTM API (= underlying WebSocket connectivity) at this moment.

The only possible cause that I can think of is that your Hubot app's WebSocket connection might be a bit unstable due to something specific to your network environment (or anything between Slack server and your Hubot app process). In this case, the Slack server-side could fail to occasionally send message events to your app.

To narrow the issue down, I would suggest trying to run the same app in a completely different setting (say, on a different cloud service) and see how it goes. If your situation persists regardless of where to run your Hubot app, something wrong may be happening to your workspace or Hubot app configuration. To resolve this, please contact our customer support team from either /feedback in your Slack workspace or https://my.slack.com/help/requests/new .

Lastly, if you don't have any particular reason to use Hubot, we highly recommend using a newer platform feature for new app development. Most of the things that Hubot w/ Slack adapter can be done with Bolt framework along with Socket Mode + Events API in a better way. Refer to the Getting Started Guide for learning how to use it.

I hope this was helpful to you and everything will work well for you soon.

@seratch Thanks. Could you tell me the ports that hubot uses.

github-actions[bot] commented 2 years ago

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.

github-actions[bot] commented 2 years ago

As this issue has been inactive for more than one month, we will be closing it. Thank you to all the participants! If you would like to raise a related issue, please create a new issue which includes your specific details and references this issue number.