Hello every body,
I am encountering an issue with my Telegraf bot integrated into a NestJS application. When the bot encounters an error, it causes my entire application to crash, which is not the desired behavior. Instead, I want my application to log the error and continue functioning without any disruptions.
e.g. this error:
Error: 409: Conflict: terminated by other getUpdates request; make sure that only one bot instance is runningFetchError: request to https://api.telegram.org/bot**********:[REDACTED]/getMe failed, reason: connect ETIMEDOUT 10.10.34.36:443
Proposed Solution:
I believe the ideal solution for this issue is to make use of the bot.catch method in Telegraf, which is designed for error handling within the bot itself. This way, the bot can log errors and continue processing, ensuring that the NestJS application remains functional even when bot errors occur.
Code Attempted
I have tried the following code to handle errors within my Telegraf bot:
Thank you for your assistance in finding a solution to this issue. If you have any recommendations or suggestions on how to implement proper error handling for the Telegraf bot within a NestJS application, please share them. Your input will be greatly appreciated.
Hello every body, I am encountering an issue with my Telegraf bot integrated into a NestJS application. When the bot encounters an error, it causes my entire application to crash, which is not the desired behavior. Instead, I want my application to log the error and continue functioning without any disruptions. e.g. this error:
Error: 409: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
FetchError: request to https://api.telegram.org/bot**********:[REDACTED]/getMe failed, reason: connect ETIMEDOUT 10.10.34.36:443
Proposed Solution: I believe the ideal solution for this issue is to make use of the bot.catch method in Telegraf, which is designed for error handling within the bot itself. This way, the bot can log errors and continue processing, ensuring that the NestJS application remains functional even when bot errors occur.Code Attempted I have tried the following code to handle errors within my Telegraf bot:
and this is how I add my telegrafModule to App Module
Thank you for your assistance in finding a solution to this issue. If you have any recommendations or suggestions on how to implement proper error handling for the Telegraf bot within a NestJS application, please share them. Your input will be greatly appreciated.