Node-red crash with node-red-contrib-telegrambot-home

Hi all :slight_smile:

Lately I have been using the nodes: node-red-contrib-telegrambot-home, I have seen that if any user blocks the BOT, the whole Node-red service restarts, I have tried with the catch to receive the error to handle it but it doesn't detect the error:

NR log:

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason: Error: ETELEGRAM: 403 Forbidden: Bot was blocked by the user at /home/pi/.node-red/node_modules/node-telegram-bot-api/src/telegram.js:291:15 at tryCatcher (/home/pi/.node-red/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/pi/.node-red/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/home/pi/.node-red/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/home/pi/.node-red/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/home/pi/.node-red/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/home/pi/.node-red/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/home/pi/.node-red/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/home/pi/.node-red/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/home/pi/.node-red/node_modules/bluebird/js/release/async.js:15:14) at processImmediate (internal/timers.js:461:21) nodered.service: Main process exited, code=exited, status=1/FAILURE nodered.service: Failed with result 'exit-code'. nodered.service: Service RestartSec=20s expired, scheduling restart. nodered.service: Scheduled restart job, restart counter is at 1.

Has this happened to anyone else? Can I do something to stop the NR service from restarting with this error?

P.S I have opened an issue on github Node-red crash when trying to send a message to a user who has blocked the BOT · Issue #37 · scraton/node-red-contrib-telegrambot-home · GitHub

Thanks in Advance for your help

Submitting an issue is the right thing to do, the node should not crash node red on this sort of error.
I suspect you may get little support though, as there is at least one rather similar issue that has been waiting for a long time to get fixed.

Is there a reason you are using that node rather than node-red-contrib-telegrambot which I think most people use?

1 Like

Thanks for the reply Colin!
Some time ago I had installed the first thing I had seen and I am sticking with telegrambot-home, due to the fact that I have more than 40 flows using these nodes, and many automated tasks, it would be unfeasible to switch to node-red-contrib-telegrambot as I would have to redo everything :frowning:

You backed the wrong :racehorse:

telegrambot is better maintained.

I'm pretty sure telegrambot-home is a clone of telegrambot so might be compatible with your flows.

My guess is you are running on nodejs v16 or higher? As of node16 promises without a catch handler will kill nodejs

Telegrambot is tested on nodejs 16.

1 Like

Hi Steve, thank's for your reply, currenty running on: Node.js v12.22.7

Hmmm. Strange. I wonder if it is something to do with bluebird promises?

What version of node-red as you on?

I currently have these versions:

Node-RED version: v2.1.3
Node.js  version: v12.22.7
Linux 5.10.63-v7+ arm LE

Hmmm - odd.

I wonder if this is a clue...

Is you bot still active (check in the telegram app/web)?
Is your key/token correct? (you can see what the token is by sending /mybots to botfather)

Yes my bot is still active and working

It only blocks and restarts the node-red if a user has blocked it and I try to send something:

We'll have to see if the developer responds to your issue.

It might be worth firing up a 2nd instance of node-red and testing node-red-contrib-telegrambot to see if that crashes?

(you can easily fire up additional node-red by entering node-red -u ~/node-red-1881 -p 1881 then opening it at http://x.x.x.x:1881)

1 Like

I have carried out the test with: node-red-contrib-telegrambot

It handles the error correctly, and does not crash or restart the NR service.

I will check if I can modify something in telegrambot-home to handle these errors, and if I can't, I will consider migrating everything to node-red-contrib-telegrambot, which will take me at least a month of work :frowning:

I find that surprising. Why is it so high?

Counting only weekends when I can migrate flows,

Although in the bot I have hundreds and hundreds of commands and intents, in the database I have 1203 local routes to deliver pdf manuals.

1 Like

Hmm, sounds like some kind of chatbot implementation? They can get out of hand really quickly.

Have you looked at rivescript at all? That can be really helpful in dealing with chatty interfaces.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.