Closed jeanfbrito closed 6 years ago
Do you have more than one bot polling with the same token?
Unhandled rejection Error: 409 {"ok":false,"error_code":409,"description":"Conflict: terminated by other long poll or webhook"}
(like two bots in the configuration drop down with the same token)
Yes, there was 2 telegram receivers. Now I'm getting another problem. Unauthorized error, but the bot is working. The problem is that exceptions are killing the docker after one day long running.
Unhandled rejection Error: 401 {"ok":false,"error_code":401,"description":"Unauthorized"} at /usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/src/telegramPolling.js:72:15 at tryCatcher (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/util.js:26:23) at Promise._settlePromiseFromHandler (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:507:31) at Promise._settlePromiseAt (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:581:18) at Promise._settlePromises (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:697:14) at Async._drainQueue (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:123:16) at Async._drainQueues (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:133:10) at Immediate.Async.drainQueues [as _onImmediate] (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:15:14) at processImmediate [as _immediateCallback] (timers.js:383:17)
You can have as many receiver as you like, all receivers use the same client, the problem is if there's some othe client using the same token or another flow using the same token, do you have a production and local environment using the same chatbot name / token? Il giorno ven 26 ago 2016 alle 16:53 Jean Brito notifications@github.com ha scritto:
Yes, there was 2 telegram receivers. Now I'm getting another problem. Unauthorized error, but the bot is working. The problem is that exceptions are killing the docker after one day long running. Unhandled rejection Error: 401 {"ok":false,"error_code":401,"description":"Unauthorized"} at /usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/src/telegramPolling.js:72:15 at tryCatcher (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/util.js:26:23) at Promise._settlePromiseFromHandler (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:507:31) at Promise._settlePromiseAt (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:581:18) at Promise._settlePromises (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:697:14) at Async._drainQueue (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:123:16) at Async._drainQueues (/usr/src/node-red/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:133:10) at Immediate.Async.drainQueues as _onImmediate at processImmediate as _immediateCallback
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/guidone/node-red-contrib-chatbot/issues/7#issuecomment-242757860, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeq9_ucnqjm_GifME-QBzntFplK4Olbks5qjv3igaJpZM4JuAXC .
No, and to test this I revoked the key and created another one. So it's only here. I can give you access to everything if you want. Is just a test server. "Flow 2" http://iot.jeanbrito.com:1880/#
Perhaps I've a clue, it could be the last path, I've to be in front a computer to verify, can you try downgrading to version 0.5.3?
Same problem with 0.5.3. Error 401.
Maybe we need to slow down the polling rate? What about you give an interface to use a timer to control the polling rate? Or a config on the telegram receiver. Seems to be a frequency limit on the telegram.
Seems a good idea, I'll work on it today
Ok now it's possible to config the polling interval #8
Now I'm using 1000ms for the polling rate and is working. No more errors. Let's see if it will survive more time alive. Thanks!
Unhandled rejection TimeoutError: operation timed out at afterTimeout (/usr/src/node-red/node_modules/node-red-contrib-chatbot/node_modules/node-telegram-bot-api/node_modules/request-promise/node_modules/bluebird/js/main/timers.js:16:15) at timeoutTimeout (/usr/src/node-red/node_modules/node-red-contrib-chatbot/node_modules/node-telegram-bot-api/node_modules/request-promise/node_modules/bluebird/js/main/timers.js:59:9) at Timer.listOnTimeout (timers.js:92:15)
Ok, it's better trap the timeout error and redirect thorug node.error to the UI
It's an unhandled exception in the Telegram library, they've fixed it
https://github.com/revkov/node-telegram-bot-api/commit/4a7c33976e178a4b5f6e41c73e6db3c931b6c9c2
but it's still not released yet, I think it's a matter of days before they tag and release this
This is what shows to me.
Here is my flow:
[{"id":"a57e8fe2.23234","type":"chatbot-telegram-send","z":"81d92955.9666a8","bot":"9fabba67.1d0838","track":false,"outputs":0,"x":948,"y":380,"wires":[]},{"id":"4cf317bf.b5b5d8","type":"chatbot-command","z":"81d92955.9666a8","name":"","command":"/gate","x":438,"y":321,"wires":[["a9be57fd.fc5088","ebd394e3.da9cf8"]]},{"id":"a9be57fd.fc5088","type":"chatbot-waiting","z":"81d92955.9666a8","waitingType":"upload_photo","x":598,"y":379,"wires":[["a57e8fe2.23234"]]},{"id":"ebd394e3.da9cf8","type":"http request","z":"81d92955.9666a8","name":"","method":"GET","ret":"bin","url":"http://mortunha.servegame.com:8000/picture/1/current","tls":"","x":609,"y":322,"wires":[["71950575.6d43ec","23970dd5.8c89c2"]]},{"id":"375c37b9.916168","type":"chatbot-image","z":"81d92955.9666a8","name":"","filename":"","track":false,"x":800,"y":315,"wires":[["a57e8fe2.23234"]]},{"id":"94bb6b.13ddf498","type":"chatbot-command","z":"81d92955.9666a8","name":"","command":"/temp","x":400,"y":462,"wires":[["66bd0b68.b9d5a4","d64f65a7.fe31a8"]]},{"id":"66bd0b68.b9d5a4","type":"chatbot-waiting","z":"81d92955.9666a8","waitingType":"typing","x":560,"y":524,"wires":[["c0deb443.0ccd98"]]},{"id":"268bc97c.9cbff6","type":"influxdb in","z":"81d92955.9666a8","influxdb":"34cd6bd7.28f7b4","name":"influxdb query","query":"","x":817,"y":459,"wires":[["c8237e0.859138"]]},{"id":"c8237e0.859138","type":"function","z":"81d92955.9666a8","name":"generate msg","func":"lastTemp = msg.payload[0][0].last;\nmsg.payload.content = \"A temperatura atual é de \" + lastTemp + \"ºC\";\nmsg.payload.chatId = msg.originalMessage.chat.id;\nmsg.payload.type = \"message\";\nreturn msg;","outputs":1,"noerr":0,"x":1025,"y":458,"wires":[["c0deb443.0ccd98"]]},{"id":"d64f65a7.fe31a8","type":"function","z":"81d92955.9666a8","name":"get last temperature","func":"msg.query=\"SELECT last(value) FROM temperature WHERE device='18fe34f36113'\";\nreturn msg;","outputs":1,"noerr":0,"x":605,"y":460,"wires":[["268bc97c.9cbff6"]]},{"id":"c0deb443.0ccd98","type":"chatbot-telegram-send","z":"81d92955.9666a8","bot":"9fabba67.1d0838","track":false,"outputs":0,"x":1255,"y":519,"wires":[]},{"id":"f3f83cf4.19a69","type":"chatbot-command","z":"81d92955.9666a8","name":"","command":"/humi","x":402,"y":593,"wires":[["59d1a7fe.d32258","1d1b302.cbc59d"]]},{"id":"59d1a7fe.d32258","type":"chatbot-waiting","z":"81d92955.9666a8","waitingType":"typing","x":562,"y":655,"wires":[["9150bd4e.e0954"]]},{"id":"2ff26296.d150fe","type":"influxdb in","z":"81d92955.9666a8","influxdb":"34cd6bd7.28f7b4","name":"influxdb query","query":"","x":819,"y":590,"wires":[["c4eb0bd7.d81008"]]},{"id":"c4eb0bd7.d81008","type":"function","z":"81d92955.9666a8","name":"generate msg","func":"lastHumi = msg.payload[0][0].last;\nmsg.payload.content = \"A humidade relativa do ar atual é de \" + lastHumi + \"%\";\nmsg.payload.chatId = msg.originalMessage.chat.id;\nmsg.payload.type = \"message\";\nreturn msg;","outputs":1,"noerr":0,"x":1027,"y":589,"wires":[["9150bd4e.e0954"]]},{"id":"1d1b302.cbc59d","type":"function","z":"81d92955.9666a8","name":"get last humidity","func":"msg.query=\"SELECT last(value) FROM humidity WHERE device='18fe34f36113'\";\nreturn msg;","outputs":1,"noerr":0,"x":587,"y":591,"wires":[["2ff26296.d150fe"]]},{"id":"9150bd4e.e0954","type":"chatbot-telegram-send","z":"81d92955.9666a8","bot":"9fabba67.1d0838","track":false,"outputs":0,"x":1257,"y":650,"wires":[]},{"id":"71950575.6d43ec","type":"debug","z":"81d92955.9666a8","name":"","active":true,"console":"false","complete":"payload","x":869,"y":248,"wires":[]},{"id":"23970dd5.8c89c2","type":"switch","z":"81d92955.9666a8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","outputs":2,"x":598,"y":208,"wires":[["375c37b9.916168"],["ebd394e3.da9cf8"]]},{"id":"3ce15339.ce359c","type":"chatbot-telegram-receive","z":"81d92955.9666a8","bot":"9fabba67.1d0838","x":113,"y":420,"wires":[["f3f83cf4.19a69","94bb6b.13ddf498"]]},{"id":"2bb715e1.74ce3a","type":"chatbot-telegram-receive","z":"81d92955.9666a8","bot":"9fabba67.1d0838","x":197,"y":313,"wires":[["4cf317bf.b5b5d8"]]},{"id":"9fabba67.1d0838","type":"chatbot-telegram-node","z":"81d92955.9666a8","botname":"Lemmy","usernames":""},{"id":"34cd6bd7.28f7b4","type":"influxdb","z":"81d92955.9666a8","hostname":"doc.jeanbrito.com","port":"8086","database":"greenhouse","name":""}]