Getting multiple messages on Slack

Hi,

I’m getting multiple duplicates of messages on Slack (same actions gets triggered). When my custom action gets called I get 200 from ngrok, but right after that I get 500 and a http_timeout error. Also I’ve added

  errors_ignore_retry: |
    - "http_timeout"

Under slack in my credentials.yml which doesn’t seem to work.

Bot is working properly on Rasa shell.

After the http_timeout I also get this error:

[1488] [ERROR] Exception occurred while handling uri: 'http://xxxxxxxxxxxx.ngrok.io/webhooks/slack/webhook'
Traceback (most recent call last):
  File "e:\anaconda\envs\chatbot_env\lib\site-packages\sanic\app.py", line 931, in handle_request
    response = await response
  File "e:\anaconda\envs\chatbot_env\lib\site-packages\rasa\core\channels\slack.py", line 526, in webhook
    return await self.process_message(
  File "e:\anaconda\envs\chatbot_env\lib\site-packages\rasa\core\channels\slack.py", line 351, in process_message
    return response.text(
  File "e:\anaconda\envs\chatbot_env\lib\site-packages\sanic\response.py", line 224, in text
    raise TypeError(
TypeError: Bad body type. Expected str, got NoneType)

And a side questions: does utter_message(text) have a string length limit? Could the errors that am getting be in any way related to new line tokens \n or emojis inside responses?

Also for some reason, half of the response text doesn’t get printed on Slack.

I have few JSON files that contain answers to questions asked by users. In custom actions I open these files and go through them in a for loop (nothing fancy) and concatenate them in one big message variable which is then given to the text= argument of utter_message method. Besides that, I followed Rasa guide for deploying bot to Slack so everything is the same except errors_ignore_retry that I mentioned earlier.

Please help!

TypeError: Bad body type. Expected str, got NoneType)

This seems to be a bug. Would you mind creating github issue for this?

Are there any warnings in the logs before the exception happens?

And a side questions: does utter_message(text) have a string length limit?

At least not on Rasa’s side. Maybe Slack has some. How many characters does your response have?

Bot Stopped responding when it goes to the custom actions We just migrated our bot from one server to another and upgraded the rasa version from 2.4.0 to 2.8.3 but stories using custom actions are not generating responses although process can be tracked to the logs and all seems fine over there but bot is unable to generate response back to the user over slack channel. it’s working in rasa shell but not on slack. we have been using these stories and in our old server with version 2.4.0 and never encountered this error (apart from few timeout errors).

Please take a cognizance over this and help us ASAP as our bot is down from a long period of time. @Tobias_Wochinger

here is the slack error we are getting on slack log file.

2021-09-03 21:00:30,013 [WARNI]  Received retry #3 request from slack due to http_timeout.
2021-09-03 21:00:30,049 [ERROR]  Exception occurred while handling uri: 'http://az2f-469-60-18-124.ngrok.io/webhooks/slack/webhook'
Traceback (most recent call last):
  File "c:\purplebot_env\lib\site-packages\sanic\app.py", line 931, in handle_request
    response = await response
  File "c:\purplebot_env\lib\site-packages\rasa\core\channels\slack.py", line 526, in webhook
    return await self.process_message(
  File "c:\purplebot_env\lib\site-packages\rasa\core\channels\slack.py", line 351, in process_message
    return response.text(
  File "c:\purplebot_env\lib\site-packages\sanic\response.py", line 224, in text
    raise TypeError(
TypeError: Bad body type. Expected str, got NoneType)
2 Likes

I am also facing the same issue, when some message given in slack triggers a custom action, this error occurs.