node-telegram-bot-api icon indicating copy to clipboard operation
node-telegram-bot-api copied to clipboard

ETELEGRAM: 400 Bad Request: bad webhook

Open melroy89 opened this issue 6 years ago • 2 comments

Expected Behavior

My bot should just run (like it did before). Using the pattern in this example: https://github.com/yagop/node-telegram-bot-api/blob/master/examples/webhook/express.js

Actual Behavior

Sometimes I got this message before, and usually it works again after a minute. But not I really can not connect anymore.

Unhandled rejection Error: ETELEGRAM: 400 Bad Request: bad webhook: Failed to resolve host: Temporary failure in name resolution
    at request.then.resp (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/node-telegram-bot-api/src/telegram.js:280:15)
    at tryCatcher (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/bluebird/js/release/promise.js:517:31)
    at Promise._settlePromise (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/bluebird/js/release/promise.js:574:18)
    at Promise._settlePromise0 (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/bluebird/js/release/promise.js:619:10)
    at Promise._settlePromises (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/bluebird/js/release/promise.js:699:18)
    at _drainQueueStep (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/mnt/c910940f-f82f-47a8-8a73-b93a7a23a069/Projects/lbry-bot/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)

Steps to reproduce the Behavior

  1. Using latest LTS nodejs (v10.16.3)
  2. Start the bot

Error code looks really similar to: https://spin.atomicobject.com/2017/04/06/nodejs-promises-callbacks/

In older version of nodejs I got warnings maybe the root cause is that the telegram API server is not responding.. Or that you mixed promises and callbacks in your code..?

I do can ping the api server:

 ping api.telegram.org
PING api.telegram.org (149.154.167.220) 56(84) bytes of data.
64 bytes from 149.154.167.220 (149.154.167.220): icmp_seq=1 ttl=57 time=8.42 ms
64 bytes from 149.154.167.220 (149.154.167.220): icmp_seq=2 ttl=57 time=8.25 ms
64 bytes from 149.154.167.220 (149.154.167.220): icmp_seq=3 ttl=57 time=8.64 ms
^C
--- api.telegram.org ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 8.258/8.442/8.641/0.156 ms

melroy89 avatar Sep 11 '19 21:09 melroy89

Without changing anything it works.. Can you implement a better error code or message? Maybe a link to the Telegram Bot status? This is very nontransparent what happens here.

melroy89 avatar Sep 11 '19 21:09 melroy89

Related: https://github.com/nodejs/help/issues/2154 Related: https://medium.com/p/c14ab6a84239/

melroy89 avatar Sep 12 '19 01:09 melroy89