yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.4k stars 1.53k forks source link

sendDocument - Error 504 EPARSE: Error parsing response #576

Closed axi92 closed 6 years ago

axi92 commented 6 years ago

I am using this code:

console.log("zip_fullpath is: " + zip_fullpath)
const fileOptions = {
    // Explicitly specify the file name.
    filename: tgid.toString() + '.zip',
    // Explicitly specify the MIME type.
    contentType: 'application/zipg',
    };
bot.sendDocument(tgid, zip_fullpat

I get this message:

Mon, 07 May 2018 15:19:57 GMT node-telegram-bot-api deprecated In the future, content-type of files you send will default to "application/octet-stream". See https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files for more information on how sending files has been improved and on how to disable this deprecation message altogether. at index.js:120:10

And after the timeout this:

Unhandled rejection Error: EPARSE: Error parsing response: <html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">

<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.12.2</center>
</body>
</html>
    at BaseError (d:\Git\bulkdownload\node_modules\node-telegram-bot-api\src\errors.js:10:5)
    at ParseError (d:\Git\bulkdownload\node_modules\node-telegram-bot-api\src\errors.js:47:5)
    at EventEmitter._request.request.then.err (d:\Git\bulkdownload\node_modules\node-telegram-bot-api\src\telegram.js:273:17)
    at tryCatcher (d:\Git\bulkdownload\node_modules\bluebird\js\release\util.js:16:23)
    at Promise.module.exports.Promise._settlePromiseFromHandler (d:\Git\bulkdownload\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise.module.exports.Promise._settlePromise (d:\Git\bulkdownload\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise.module.exports.Promise._settlePromise0 (d:\Git\bulkdownload\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise.module.exports.Promise._settlePromises (d:\Git\bulkdownload\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (d:\Git\bulkdownload\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (d:\Git\bulkdownload\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.e.Async.drainQueues (d:\Git\bulkdownload\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)
sidelux commented 6 years ago

Ti fix deprecation message add this line at top of the code: process.env["NTBA_FIX_350"] = 1;

The next error i think you have problem to see telegram server from your, or telegram api was offline (it happens sometimes...).