There is a telegram bot written in python with the telepot library. I poured it on heroku. Previously, everything worked, but once again I updated it and it gives me the following error:

telepot.exception.TelegramError: ('Conflict: terminated by other getUpdates request; make sure that only one bot is running', 409, {'ok': False, 'error_code': 409, 'description': 'Conflict: terminated by other getUpdates request; make sure that only one bot instance is running '})

I have nowhere else run this bot. Moreover, everything works without problems when I run a heroku local or just a flask run. And on heroku does not work. Please tell me what could be the problem.

    2 answers 2

    Apparently, you have already launched a web browser from another URL or you use GetUpdates somewhere else. Try to specify in the code of the bot itself, first remove the old webbook, and only then install it again. It helped me at one time

    • I don’t use webhook at all. And getUpdates is not running anywhere else. Now I tried to write deleteWebhook in the code just in case - it did not help. - Vlad Riabets pm

    The problem was that my heroku application runs 2 processes (the so-called worker). And locally it is launched 1. Here in this question I laid out the logs: heroku starts 2 worker instead of 1

    The solution came to light when I ran a heroku run bash and looked at the environment variables with the env command. I found the variable WEB_CONCURRENCY = 2 interesting. After I set it to 1 in the application settings, everything worked as it should.

    • Mark your answer with a solution, this will make it easier for him to search for other users who have the same problem. - Sergey Gornostaev