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
Slack triggers multiple messages to rasa (does not happen with Telegram/Commandline) #2120
Comments
Can I ask with what bot you're trying this? And have you definitely tried this with the exact same stories on each channel? Because I looked into this a while ago with the restaurant bot and it happened on the command line as well. But I can take a look again |
@akelad yes, definitely ... 100% reproduceable (Telegram and Commandline works, but Slack doesn't). Please note, I'm using the following Slack Subscriptions:
|
ok thanks, we'll take a look |
hey @ewagner70, I just tried to reproduce this by running the moodbot from our examples, and it's behaving completely normally for me. Can you provide some more details as to when this error happens, which bot this is with etc? |
also exactly which features you've enabled |
Thanks, I will try to reproduce again with your bot! |
ok i actually reproduced it with the restaurantbot. So the issue is the fact that you're subscribed to Workspace Events:
the bot processes any direct messages you receive/send and so it continues replying to the channel you've specified |
@akelad I had this same issue yesterday, and in my Slack app config, I am only subscribed to "Bot Events". At one point, I received 6 messages back from a single query. Note that this is the first time we experienced this issue. |
Which bot events are you subscribed to exactly? Also does the same conversation with the same model work fine on the command line? |
To answer your second question, the same convo worked fine in command line. |
haha i am very lost as to how this is happening. @ewagner70 have you checked whether turning the workplace events off fixes your problem? |
@Walter-Ullon, @akelad I too have a similar issue. It works perfectly fine on the console but not with slack.
I was getting following error sometime back:
Which I eventually traced back to rasa core complaining about Just to mention - I also have a fallback action and an action which uploads a file to slack. So file starts getting uploaded multiple times and I see a lot of fallback messages. |
Ok, so I assume the error message you're getting there might have something to do with the uploading file part. Do you still encounter that error message? And if not, does that POST request keep happening repeatedly? |
can one of the people having this problem please post a full trace of their debug log when something like this happens? (so running the bot with the --debug flag) |
@akelad I can confirm that uploading file is not a problem nor is the fallback action as I removed all of the functionality and now have a simple greeting intent for which I am receiving 3 responses. I even tried disabling events subscription and re-enabling it all over again. Here is the DEBUG trace:
|
it seems it's receiving the message "hi" over and over again... the repeated POSTs should be fine. How are you chatting to the bot, in a direct message with it, or a channel? |
Below is the log for a single query for which I received 3 responses. It happens for multiple intents. Note that this behavior is present when I test with the code deployed in AWS, and when I open my local build using ngrok. Also note that I'm still using core 0.8.5 (no fallback policy activated). Of course, everything is going through Slack... I am talking to the bot (app) in a direct message.
|
ok and your running this over command line or with a custom python script? if it's a custom python script could you post it here? |
@akelad The logs above were pulled from the machine after sending commands through Slack. Is that what you're asking? I don't have a custom script for running these commands. When using the terminal (i.e. no Slack in between) this issue does not appear. Happy to do a zoom with you and walk through it if it would help. |
No sorry, I meant the connection to slack, is it with |
Oh, sorry. Just the command below. No custom script.
|
@akelad Extremely sorry for having parallel conversations. I am conversing with the bot app, here is how my slack credential file looks like:
|
@akelad sorry for not responding earlier ... got back from an European business trip this evening. I've reduced slack bot subscriptions down to:
but to no avail ... even reducing further down to only 1 of the 2 above message will still trigger multiple responses after the 3rd message ... any potential relation to that issue #393 from howdyai/botkit? |
ok, so for someone looking for a quick fix - In case of duplicate message response by bot I found that
if I track this using a list, this is what I get. for the time being, I just ignore the duplicate event_id requests and it works. |
@prateekchoudhary thx for your workaround hint! |
@ewagner70 Sure! I have had a marathon 40 hrs trying to debug this. Also it would be helpful if you let me know if this actually worked for you. If this 'hotfix' works, we can develop further on this.
in the
|
@prateekchoudhary thx alot ... yes, it "works as designed" (slackbot API still sends multiple messages, but slack.py in rasa_core ignores the duplicates and yes, an ever growing list should not be a sustainable solution - but I don't have any other suggestion yet). A small improvement suggestion, Prateek: as the messages are only sent a few times (I think 3-4 times), the list could be amended with a counter and once either the counter reaches a certain threshold or a certain timeframe passes (1 hour or so) the list-entry then gets deleted. As hotfix for the time being ok and I fully concur that Rasa Team should come up with a sustainable solution (!) - especially if they reproduce that error with their own bots. |
thanks for all your effort/info guys, sadly we still haven't been able to reproduce this, but we're working on a solution based on your idea here. We'll keep you updated. |
I think I see why...
and it seems to be successful except that Slack will still send max retry (3 times) regardless of value specified in the header. I'm more than happy to make PR if this is an acceptable solution. |
@ewagner70 , that would depend on your app/server. In my case, the error was the timeout (took me longer than 3 sec to reply cause I was tracing). for a 2nd request (RETRY_NUM = 1) it will output to logger reason why slack thinks it is a failure. |
@naoko we actually got that same information from the slack team as well. I haven't had time to look into it again yet, sorry! but yes, please create a PR with that fix and i'll take a look at it |
@akelad , I've posted PR. thank you for reviewing! |
@naoko I have tried your method and made the necessary changes to rasa_core.channels.slack.py but I still am getting multiple responses... |
@devansh1497 , are u using current master? or you modified the source on older version?
|
This seems to be a breaking fix for slack. While the idea and logic is perfect, I do not see any output in slack channel after taking the latest source. The same code without retires works. Looking into this deeper as this is an issue for me just like @devansh1497 - API takes more than 3 secs. |
Got the issue, specific to one scenario. When the user posts a message in a channel, and not directly chatting with a bot, the channel is not being passed in. Got fix working on my local env, will add tests and raise a PR. |
Rasa Core version: 0.9.0a5
Python version: 3.6
Operating system (windows, osx, ...): ubuntu 18.04
Issue: Slack triggers multiple messages to rasa and NO, this does not happen with Telegram and Commandline Interface (!) with the very same trained RASA_NLU and RASA_CORE models (!!)
Please, Rasa-Team: Try to reproduce that with any kind of story!
Content of domain file (if used & relevant):
The text was updated successfully, but these errors were encountered: