Search code examples
google-app-enginepython-telegram-bot

Python telegram bot persistence with google app engine


I am deploying a Telegram BOT using Python Telegram Bot library on Google App Engine flexible environment and have enabled bot and conversation persistence on this.

The challenge I am facing is, if I update the app and deploy again the conversation has to be restarted since I am unable to copy the persistence file from the previous version of the app.

How do I ensure that the same persistence files are used whenever I deploy a new version of the APP?

Any help is appreciated.

Thank you


Solution

  • If you are writing to the /tmp directory or storing that file inside App Engine's file system, that is expected to happen.

    The docs for the standard environment explain this as well, and when you're doing a new deploy the instance you were using gets deleted and then you lose your persistence file with the logs of the chat.

    You should consider moving the file to Cloud Storage or using any other storage system to save the changes and upload/downlaod the file on a regular basis in order to avoid that.