rasa: Edited message on telegram creates infinite loop

Rasa version: 1.9.5

Rasa SDK version (if used & relevant): n/a

Rasa X version (if used & relevant): n/a

Python version: unsure. using the Docker image rasa/rasa:1.9.5-full

Operating system (windows, osx, …): Docker on OSX, using rasa/rasa:1.9.5-full

Issue:

When a user edits a message on Telegram, this creates a 500 error on rasa, because the payload contains “edited_message” rather than “message” (see screenshots).

This then creates an infinite loop because Rasa sends a 500 back so Telegram keeps retrying. And Telegram is very persistent.

Where it gets worse is that Telegram seems to queue all subsequent messages for retry, even if those went through OK. So this can all get pretty apocalyptic (I was only able to get back control by creating a fake endpoint that just sent a bunch of 200 back to Telegram to empty the queue).

I reckon it’s the same problem as described here: https://github.com/python-telegram-bot/python-telegram-bot/issues/1244 The proposed solution there is to use “effective_message”, which apparently would cover both “message” and “edited_message”.

Error (including full traceback): image

image

Traceback (most recent call last):
  File "/opt/venv/lib/python3.6/site-packages/sanic/app.py", line 976, in handle_request
    response = await response
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "/opt/venv/lib/python3.6/site-packages/rasa/core/channels/telegram.py", line 215, in message
    if self._is_user_message(msg):
  File "/opt/venv/lib/python3.6/site-packages/rasa/core/channels/telegram.py", line 175, in _is_user_message
    return message.text is not None
AttributeError: 'NoneType' object has no attribute 'text'

Command or request that led to error:

image

(this is on Telegram for Desktop (Mac OS X). Just type a message, send it, arrow up to edit, make a change and resend)

Content of configuration file (config.yml) (if relevant): Not relevant

Content of domain file (domain.yml) (if relevant): Not relevant

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

No worries. Let me take a look into it!