node-telegram-bot-api
node-telegram-bot-api copied to clipboard
ETELEGRAM 400 Bad Request: host is invalid
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.
Post the bot code. Are you somehow trying to pass in a URL as a para to sendPhoto
?
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.
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.