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

ETELEGRAM 400 Bad Request: host is invalid

Open llgdd opened this issue 5 years ago • 3 comments

Searching through the issues, I haven't found any matching my problem. I used Puppeteer to screenshot webpages and send them to users using the bot. But I keep getting this: Unhandled rejection Error: ETELEGRAM: 400 Bad Request: host is invalid at request.then.resp (d:\Documents\Bots\node_modules\node-telegram-bot-api\src\telegram.js:280:15) at tryCatcher (d:\Documents\Bots\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (d:\Documents\Bots\node_modules\bluebird\js\release\promise.js:517:31) at Promise._settlePromise (d:\Documents\Bots\node_modules\bluebird\js\release\promise.js:574:18) at Promise._settlePromise0 (d:\Documents\Bots\node_modules\bluebird\js\release\promise.js:619:10) at Promise._settlePromises (d:\Documents\Bots\node_modules\bluebird\js\release\promise.js:699:18) at _drainQueueStep (d:\Documents\Bots\node_modules\bluebird\js\release\async.js:138:12) at _drainQueue (d:\Documents\Bots\node_modules\bluebird\js\release\async.js:131:9) at Async._drainQueues (d:\Documents\Bots\node_modules\bluebird\js\release\async.js:147:5) at Immediate.Async.drainQueues (d:\Documents\Bots\node_modules\bluebird\js\release\async.js:17:14) at runCallback (timers.js:781:20) at tryOnImmediate (timers.js:743:5) at processImmediate [as _immediateCallback] (timers.js:714:5)

This started out when I added the sendPhoto function.

llgdd avatar Aug 17 '19 17:08 llgdd

Post the bot code. Are you somehow trying to pass in a URL as a para to sendPhoto ?

kamikazechaser avatar Sep 02 '19 13:09 kamikazechaser

I'll post the code once I get home. I didn't pass URL, I set a relative path to file instead. UPD: everything works fine after some changes to the code, but the error is still there.

llgdd avatar Sep 03 '19 10:09 llgdd

Hi, I got the same error when I tried to send local path of image but path was incorrect. Try to use fs.createReadStream and you will get error in case of file is not found.

ricustr avatar Oct 28 '19 10:10 ricustr