today I opened my server error logs and i got tons (like 2 per second) of these errors:
7/12/2017, 1:38:41 PM - P.12854 - Unhandled rejection Error: 502 <html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.10.0</center>
</body>
</html>
at /home/ubuntu/Licode_v3/node_modules/node-telegram-bot-api/lib/telegramPolling.js:133:17
at tryCatcher (/home/ubuntu/Licode_v3/node_modules/request-promise/node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (/home/ubuntu/Licode_v3/node_modules/request-promise/node_modules/bluebird/js/main/promise.js:510:31)
at Promise._settlePromiseAt (/home/ubuntu/Licode_v3/node_modules/request-promise/node_modules/bluebird/js/main/promise.js:584:18)
at Promise._settlePromises (/home/ubuntu/Licode_v3/node_modules/request-promise/node_modules/bluebird/js/main/promise.js:700:14)
at Async._drainQueue (/home/ubuntu/Licode_v3/node_modules/request-promise/node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (/home/ubuntu/Licode_v3/node_modules/request-promise/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues (/home/ubuntu/Licode_v3/node_modules/request-promise/node_modules/bluebird/js/main/async.js:15:14)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
7/12/2017, 1:39:01 PM - P.12854 - Unhandled rejection TimeoutError: operation timed out
at afterTimeout (/home/ubuntu/Licode_v3/node_modules/request-promise/node_modules/bluebird/js/main/timers.js:16:15)
at Timeout.timeoutTimeout (/home/ubuntu/Licode_v3/node_modules/request-promise/node_modules/bluebird/js/main/timers.js:59:9)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
in my code I wrote
` // error handler (avoid spam in console)
telegram.on('polling_error', function(error) {});
telegram.on('webhook_error', function(error) {});
`
to prevent my log to get flooded but they didn't caught these errors.
Is there any way to catch these errors?
Probably the telegram servers were down and the bot tried to poll them.
thanks guys!!
Please confirm you are using the latest version of the library.
"node-telegram-bot-api": "^0.27.1",
maybe that's the point.
Same error for me, I have the latest version ...
But I can provide more Stacktrace:
{ Error: EPARSE: Error parsing Telegram response:
<html><head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.10.0</center>
</body>
</html>
at request.then.resp (/home/sherlock/projects/gekko/node_modules/node-telegram-bot-api/src/telegram.js:174:17)
at tryCatcher (/home/sherlock/projects/gekko/node_modules/request-promise/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/sherlock/projects/gekko/node_modules/request-promise/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/sherlock/projects/gekko/node_modules/request-promise/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/sherlock/projects/gekko/node_modules/request-promise/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/sherlock/projects/gekko/node_modules/request-promise/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/home/sherlock/projects/gekko/node_modules/request-promise/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/sherlock/projects/gekko/node_modules/request-promise/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/home/sherlock/projects/gekko/node_modules/request-promise/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
code: 'EPARSE',
response:
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: [Object],
close: [Object],
data: [Function],
error: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
socket:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: false,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: [Object],
_parent: null,
_host: 'api.telegram.org',
_readableState: [Object],
readable: true,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: true,
allowHalfOpen: false,
destroyed: false,
_bytesDispatched: 5778,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [Object],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: null,
read: [Function],
_consuming: true },
connection:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: false,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: [Object],
_parent: null,
_host: 'api.telegram.org',
_readableState: [Object],
readable: true,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: true,
allowHalfOpen: false,
destroyed: false,
_bytesDispatched: 5778,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [Object],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: null,
read: [Function],
_consuming: true },
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers:
{ server: 'nginx/1.10.0',
date: 'Sat, 12 Aug 2017 03:33:38 GMT',
'content-type': 'text/html',
'content-length': '173',
connection: 'keep-alive',
'access-control-allow-origin': '*',
'access-control-expose-headers': 'Content-Length,Content-Type,Date,Server,Connection' },
rawHeaders:
[ 'Server',
'nginx/1.10.0',
'Date',
'Sat, 12 Aug 2017 03:33:38 GMT',
'Content-Type',
'text/html',
'Content-Length',
'173',
'Connection',
'keep-alive',
'Access-Control-Allow-Origin',
'*',
'Access-Control-Expose-Headers',
'Content-Length,Content-Type,Date,Server,Connection' ],
trailers: {},
rawTrailers: [],
upgrade: false,
url: '',
method: null,
statusCode: 502,
statusMessage: 'Bad Gateway',
client:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: false,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: [Object],
_parent: null,
_host: 'api.telegram.org',
_readableState: [Object],
readable: true,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: true,
allowHalfOpen: false,
destroyed: false,
_bytesDispatched: 5778,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [Object],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: null,
read: [Function],
_consuming: true },
_consuming: true,
_dumped: false,
req:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: false,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedHeader: [Object],
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Object],
connection: [Object],
_header: 'POST /bot397925595:AAGznMZFIMMlL6HPymfKX2PGDlsV8CHZNvI/getUpdates HTTP/1.1\r\nhost: api.telegram.org\r\ncontent-type: application/x-www-form-urlencoded\r\ncontent-length: 19\r\nConnection: keep-alive\r\n\r\n',
_headers: [Object],
_headerNames: [Object],
_onPendingData: null,
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/bot397925595:AAGznMZFIMMlL6HPymfKX2PGDlsV8CHZNvI/getUpdates',
_ended: true,
res: [Circular],
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null },
request:
Request {
domain: null,
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
method: 'POST',
simple: false,
resolveWithFullResponse: true,
forever: true,
readable: true,
writable: true,
explicitMethod: true,
_qs: [Object],
_auth: [Object],
_oauth: [Object],
_multipart: [Object],
_redirect: [Object],
_tunnel: [Object],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Object],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
headers: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: [Object],
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
uri: [Object],
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'api.telegram.org',
body: 'offset=0&timeout=10',
path: '/bot397925595:AAGznMZFIMMlL6HPymfKX2PGDlsV8CHZNvI/getUpdates',
httpModule: [Object],
agentClass: [Object],
agentOptions: [Object],
agent: [Object],
_started: true,
href: 'https://api.telegram.org/bot397925595:AAGznMZFIMMlL6HPymfKX2PGDlsV8CHZNvI/getUpdates',
req: [Object],
ntick: true,
response: [Circular],
originalHost: 'api.telegram.org',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true },
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
read: [Function],
body: '<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body bgcolor="white">\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.10.0</center>\r\n</body>\r\n</html>\r\n' } }
If there are no listeners for the polling_error or webhook_error, the error is logged to the console. That is the default behavior. Therefore, if you want to handle the errors differently, you will need to attach listeners for the relevant events.
On the other hand, ensure that you pay attention to such errors thrown by the bot. Usually (not always) such errors are caused by the bot being unable to reach the Telegram servers.
See https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#error-handling.
My problem isn't error handling, I just wanna know why I got this error fulltime to avoid it.
Cause at the same time, doing the same request with my browser worked nicely, so I assume it's a bug from the lib
Are you using polling in your bot?
Yes
+1
You are simply getting a 502 Bad Gateway error response. My assumption is that Telegram servers use Nginx as a proxy to their backend. Should their backend go offline (or sth equally terrible...), then you will happen to receive this kind of error. The library is working as expected (However, we've improved the default error logging to not include the stack trace, just to be less verbose). It is a problem with the API.
@GochoMugo huh this stacktrace is really ridiculous
error logging isn't disabled for 0.29.0 (latest npm package), isn't it? only in master branch? :(
@JerryGreen We will be shipping it in the next few days.
I have the same problem.
Unhandled rejection Error: EPARSE: Error parsing Telegram response: <html>
<head><title>500 Internal Server Error</title></head>
<body bgcolor="white">
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx/1.12.2</center>
</body>
</html>
+1
ERROR:: 'Telegram Error' { Error: EPARSE: Error parsing Telegram response:
2018-04-29T10:45:35.253616+00:00 app[worker.1]:
+1, and it seems to be a generalized issue.
same here, the error should be treated differently by default otherwise it just ruins the server logs.
Maybe have a default condition for 502 Bad Gateway and don't log so many lines, only say
"Telegram reported error 502 Bad Gateway"
I am getting this too. @hems is right it just ruins there server logs.
<head><title>502 Bad Gateway</title></head>
May 22 18:13:43 qroomcleaningbot app/web.1: <body bgcolor="white">
May 22 18:13:43 qroomcleaningbot app/web.1: <center><h1>502 Bad Gateway</h1></center>
May 22 18:13:43 qroomcleaningbot app/web.1: <hr><center>nginx/1.12.2</center>
May 22 18:13:43 qroomcleaningbot app/web.1: </body>
May 22 18:13:43 qroomcleaningbot app/web.1: </html>
May 22 18:13:43 qroomcleaningbot app/web.1: at BaseError (/app/node_modules/node-telegram-bot-api/src/errors.js:10:5)
May 22 18:13:43 qroomcleaningbot app/web.1: at ParseError (/app/node_modules/node-telegram-bot-api/src/errors.js:41:5)
May 22 18:13:43 qroomcleaningbot app/web.1: at request.then.err (/app/node_modules/node-telegram-bot-api/src/telegram.js:238:17)
May 22 18:13:43 qroomcleaningbot app/web.1: at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
May 22 18:13:43 qroomcleaningbot app/web.1: at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:512:31)
May 22 18:13:43 qroomcleaningbot app/web.1: at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:569:18)
May 22 18:13:43 qroomcleaningbot app/web.1: at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:614:10)
May 22 18:13:43 qroomcleaningbot app/web.1: at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:693:18)
May 22 18:13:43 qroomcleaningbot app/web.1: at Async._drainQueue (/app/node_modules/bluebird/js/release/async.js:133:16)
May 22 18:13:43 qroomcleaningbot app/web.1: at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:143:10)
May 22 18:13:43 qroomcleaningbot app/web.1: at Immediate.Async.drainQueues (/app/node_modules/bluebird/js/release/async.js:17:14)
May 22 18:13:43 qroomcleaningbot app/web.1: at runCallback (timers.js:566:20)
May 22 18:13:43 qroomcleaningbot app/web.1: at tryOnImmediate (timers.js:546:5)
May 22 18:13:43 qroomcleaningbot app/web.1: at processImmediate [as _immediateCallback] (timers.js:525:5)
May 22 18:13:43 qroomcleaningbot app/web.1: code: 'EPARSE',
May 22 18:13:43 qroomcleaningbot app/web.1: response:
May 22 18:13:43 qroomcleaningbot app/web.1: IncomingMessage {
May 22 18:13:43 qroomcleaningbot app/web.1: _readableState:
May 22 18:13:43 qroomcleaningbot app/web.1: ReadableState {
May 22 18:13:43 qroomcleaningbot app/web.1: objectMode: false,
May 22 18:13:43 qroomcleaningbot app/web.1: highWaterMark: 16384,
May 22 18:13:43 qroomcleaningbot app/web.1: buffer: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: length: 0,
May 22 18:13:43 qroomcleaningbot app/web.1: pipes: null,
May 22 18:13:43 qroomcleaningbot app/web.1: pipesCount: 0,
May 22 18:13:43 qroomcleaningbot app/web.1: flowing: true,
May 22 18:13:43 qroomcleaningbot app/web.1: ended: true,
May 22 18:13:43 qroomcleaningbot app/web.1: endEmitted: true,
May 22 18:13:43 qroomcleaningbot app/web.1: reading: false,
May 22 18:13:43 qroomcleaningbot app/web.1: sync: true,
May 22 18:13:43 qroomcleaningbot app/web.1: needReadable: false,
May 22 18:13:43 qroomcleaningbot app/web.1: emittedReadable: false,
May 22 18:13:43 qroomcleaningbot app/web.1: readableListening: false,
May 22 18:13:43 qroomcleaningbot app/web.1: resumeScheduled: false,
May 22 18:13:43 qroomcleaningbot app/web.1: defaultEncoding: 'utf8',
May 22 18:13:43 qroomcleaningbot app/web.1: ranOut: false,
May 22 18:13:43 qroomcleaningbot app/web.1: awaitDrain: 0,
May 22 18:13:43 qroomcleaningbot app/web.1: readingMore: false,
May 22 18:13:43 qroomcleaningbot app/web.1: decoder: null,
May 22 18:13:43 qroomcleaningbot app/web.1: encoding: null },
May 22 18:13:43 qroomcleaningbot app/web.1: readable: false,
May 22 18:13:43 qroomcleaningbot app/web.1: domain: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _events:
May 22 18:13:43 qroomcleaningbot app/web.1: { end: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: close: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: data: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: error: [Function] },
May 22 18:13:43 qroomcleaningbot app/web.1: _eventsCount: 4,
May 22 18:13:43 qroomcleaningbot app/web.1: _maxListeners: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: socket:
May 22 18:13:43 qroomcleaningbot app/web.1: TLSSocket {
May 22 18:13:43 qroomcleaningbot app/web.1: _tlsOptions: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _secureEstablished: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _securePending: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _newSessionPending: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _controlReleased: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _SNICallback: null,
May 22 18:13:43 qroomcleaningbot app/web.1: servername: null,
May 22 18:13:43 qroomcleaningbot app/web.1: npnProtocol: false,
May 22 18:13:43 qroomcleaningbot app/web.1: alpnProtocol: false,
May 22 18:13:43 qroomcleaningbot app/web.1: authorized: true,
May 22 18:13:43 qroomcleaningbot app/web.1: authorizationError: null,
May 22 18:13:43 qroomcleaningbot app/web.1: encrypted: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _events: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _eventsCount: 9,
May 22 18:13:43 qroomcleaningbot app/web.1: connecting: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _hadError: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _handle: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _parent: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _host: 'api.telegram.org',
May 22 18:13:43 qroomcleaningbot app/web.1: _readableState: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: readable: true,
May 22 18:13:43 qroomcleaningbot app/web.1: domain: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _maxListeners: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: _writableState: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: writable: true,
May 22 18:13:43 qroomcleaningbot app/web.1: allowHalfOpen: false,
May 22 18:13:43 qroomcleaningbot app/web.1: destroyed: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _bytesDispatched: 4884,
May 22 18:13:43 qroomcleaningbot app/web.1: _sockname: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _pendingData: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _pendingEncoding: '',
May 22 18:13:43 qroomcleaningbot app/web.1: server: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: _server: null,
May 22 18:13:43 qroomcleaningbot app/web.1: ssl: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _requestCert: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _rejectUnauthorized: true,
May 22 18:13:43 qroomcleaningbot app/web.1: parser: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _httpMessage: null,
May 22 18:13:43 qroomcleaningbot app/web.1: read: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: _consuming: true },
May 22 18:13:43 qroomcleaningbot app/web.1: connection:
May 22 18:13:43 qroomcleaningbot app/web.1: TLSSocket {
May 22 18:13:43 qroomcleaningbot app/web.1: _tlsOptions: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _secureEstablished: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _securePending: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _newSessionPending: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _controlReleased: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _SNICallback: null,
May 22 18:13:43 qroomcleaningbot app/web.1: servername: null,
May 22 18:13:43 qroomcleaningbot app/web.1: npnProtocol: false,
May 22 18:13:43 qroomcleaningbot app/web.1: alpnProtocol: false,
May 22 18:13:43 qroomcleaningbot app/web.1: authorized: true,
May 22 18:13:43 qroomcleaningbot app/web.1: authorizationError: null,
May 22 18:13:43 qroomcleaningbot app/web.1: encrypted: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _events: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _eventsCount: 9,
May 22 18:13:43 qroomcleaningbot app/web.1: connecting: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _hadError: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _handle: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _parent: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _host: 'api.telegram.org',
May 22 18:13:43 qroomcleaningbot app/web.1: _readableState: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: readable: true,
May 22 18:13:43 qroomcleaningbot app/web.1: domain: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _maxListeners: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: _writableState: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: writable: true,
May 22 18:13:43 qroomcleaningbot app/web.1: allowHalfOpen: false,
May 22 18:13:43 qroomcleaningbot app/web.1: destroyed: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _bytesDispatched: 4884,
May 22 18:13:43 qroomcleaningbot app/web.1: _sockname: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _pendingData: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _pendingEncoding: '',
May 22 18:13:43 qroomcleaningbot app/web.1: server: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: _server: null,
May 22 18:13:43 qroomcleaningbot app/web.1: ssl: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _requestCert: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _rejectUnauthorized: true,
May 22 18:13:43 qroomcleaningbot app/web.1: parser: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _httpMessage: null,
May 22 18:13:43 qroomcleaningbot app/web.1: read: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: _consuming: true },
May 22 18:13:43 qroomcleaningbot app/web.1: httpVersionMajor: 1,
May 22 18:13:43 qroomcleaningbot app/web.1: httpVersionMinor: 1,
May 22 18:13:43 qroomcleaningbot app/web.1: httpVersion: '1.1',
May 22 18:13:43 qroomcleaningbot app/web.1: complete: true,
May 22 18:13:43 qroomcleaningbot app/web.1: headers:
May 22 18:13:43 qroomcleaningbot app/web.1: { server: 'nginx/1.12.2',
May 22 18:13:43 qroomcleaningbot app/web.1: date: 'Wed, 23 May 2018 01:13:37 GMT',
May 22 18:13:43 qroomcleaningbot app/web.1: 'content-type': 'text/html',
May 22 18:13:43 qroomcleaningbot app/web.1: 'content-length': '173',
May 22 18:13:43 qroomcleaningbot app/web.1: connection: 'keep-alive',
May 22 18:13:43 qroomcleaningbot app/web.1: 'access-control-allow-origin': '*',
May 22 18:13:43 qroomcleaningbot app/web.1: 'access-control-expose-headers': 'Content-Length,Content-Type,Date,Server,Connection' },
May 22 18:13:43 qroomcleaningbot app/web.1: rawHeaders:
May 22 18:13:43 qroomcleaningbot app/web.1: [ 'Server',
May 22 18:13:43 qroomcleaningbot app/web.1: 'nginx/1.12.2',
May 22 18:13:43 qroomcleaningbot app/web.1: 'Date',
May 22 18:13:43 qroomcleaningbot app/web.1: 'Wed, 23 May 2018 01:13:37 GMT',
May 22 18:13:43 qroomcleaningbot app/web.1: 'Content-Type',
May 22 18:13:43 qroomcleaningbot app/web.1: 'text/html',
May 22 18:13:43 qroomcleaningbot app/web.1: 'Content-Length',
May 22 18:13:43 qroomcleaningbot app/web.1: '173',
May 22 18:13:43 qroomcleaningbot app/web.1: 'Connection',
May 22 18:13:43 qroomcleaningbot app/web.1: 'keep-alive',
May 22 18:13:43 qroomcleaningbot app/web.1: 'Access-Control-Allow-Origin',
May 22 18:13:43 qroomcleaningbot app/web.1: '*',
May 22 18:13:43 qroomcleaningbot app/web.1: 'Access-Control-Expose-Headers',
May 22 18:13:43 qroomcleaningbot app/web.1: 'Content-Length,Content-Type,Date,Server,Connection' ],
May 22 18:13:43 qroomcleaningbot app/web.1: trailers: {},
May 22 18:13:43 qroomcleaningbot app/web.1: rawTrailers: [],
May 22 18:13:43 qroomcleaningbot app/web.1: upgrade: false,
May 22 18:13:43 qroomcleaningbot app/web.1: url: '',
May 22 18:13:43 qroomcleaningbot app/web.1: method: null,
May 22 18:13:43 qroomcleaningbot app/web.1: statusCode: 502,
May 22 18:13:43 qroomcleaningbot app/web.1: statusMessage: 'Bad Gateway',
May 22 18:13:43 qroomcleaningbot app/web.1: client:
May 22 18:13:43 qroomcleaningbot app/web.1: TLSSocket {
May 22 18:13:43 qroomcleaningbot app/web.1: _tlsOptions: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _secureEstablished: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _securePending: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _newSessionPending: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _controlReleased: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _SNICallback: null,
May 22 18:13:43 qroomcleaningbot app/web.1: servername: null,
May 22 18:13:43 qroomcleaningbot app/web.1: npnProtocol: false,
May 22 18:13:43 qroomcleaningbot app/web.1: alpnProtocol: false,
May 22 18:13:43 qroomcleaningbot app/web.1: authorized: true,
May 22 18:13:43 qroomcleaningbot app/web.1: authorizationError: null,
May 22 18:13:43 qroomcleaningbot app/web.1: encrypted: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _events: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _eventsCount: 9,
May 22 18:13:43 qroomcleaningbot app/web.1: connecting: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _hadError: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _handle: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _parent: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _host: 'api.telegram.org',
May 22 18:13:43 qroomcleaningbot app/web.1: _readableState: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: readable: true,
May 22 18:13:43 qroomcleaningbot app/web.1: domain: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _maxListeners: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: _writableState: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: writable: true,
May 22 18:13:43 qroomcleaningbot app/web.1: allowHalfOpen: false,
May 22 18:13:43 qroomcleaningbot app/web.1: destroyed: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _bytesDispatched: 4884,
May 22 18:13:43 qroomcleaningbot app/web.1: _sockname: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _pendingData: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _pendingEncoding: '',
May 22 18:13:43 qroomcleaningbot app/web.1: server: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: _server: null,
May 22 18:13:43 qroomcleaningbot app/web.1: ssl: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _requestCert: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _rejectUnauthorized: true,
May 22 18:13:43 qroomcleaningbot app/web.1: parser: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _httpMessage: null,
May 22 18:13:43 qroomcleaningbot app/web.1: read: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: _consuming: true },
May 22 18:13:43 qroomcleaningbot app/web.1: _consuming: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _dumped: false,
May 22 18:13:43 qroomcleaningbot app/web.1: req:
May 22 18:13:43 qroomcleaningbot app/web.1: ClientRequest {
May 22 18:13:43 qroomcleaningbot app/web.1: domain: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _events: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _eventsCount: 5,
May 22 18:13:43 qroomcleaningbot app/web.1: _maxListeners: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: output: [],
May 22 18:13:43 qroomcleaningbot app/web.1: outputEncodings: [],
May 22 18:13:43 qroomcleaningbot app/web.1: outputCallbacks: [],
May 22 18:13:43 qroomcleaningbot app/web.1: outputSize: 0,
May 22 18:13:43 qroomcleaningbot app/web.1: writable: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _last: false,
May 22 18:13:43 qroomcleaningbot app/web.1: chunkedEncoding: false,
May 22 18:13:43 qroomcleaningbot app/web.1: shouldKeepAlive: true,
May 22 18:13:43 qroomcleaningbot app/web.1: useChunkedEncodingByDefault: true,
May 22 18:13:43 qroomcleaningbot app/web.1: sendDate: false,
May 22 18:13:43 qroomcleaningbot app/web.1: _removedHeader: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _contentLength: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _hasBody: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _trailer: '',
May 22 18:13:43 qroomcleaningbot app/web.1: finished: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _headerSent: true,
May 22 18:13:43 qroomcleaningbot app/web.1: socket: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: connection: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _header: 'POST /bot514208409:AAGp8RZNjPzWBwiSnME4Mh8KjCfDFTIjx1E/getUpdates HTTP/1.1\r\nhost: api.telegram.org\r\ncontent-type: application/x-www-form-urlencoded\r\ncontent-length: 27\r\nConnection: keep-alive\r\n\r\n',
May 22 18:13:43 qroomcleaningbot app/web.1: _headers: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _headerNames: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _onPendingData: null,
May 22 18:13:43 qroomcleaningbot app/web.1: agent: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: socketPath: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: method: 'POST',
May 22 18:13:43 qroomcleaningbot app/web.1: path: '/bot514208409:AAGp8RZNjPzWBwiSnME4Mh8KjCfDFTIjx1E/getUpdates',
May 22 18:13:43 qroomcleaningbot app/web.1: _ended: true,
May 22 18:13:43 qroomcleaningbot app/web.1: parser: null,
May 22 18:13:43 qroomcleaningbot app/web.1: res: [Circular] },
May 22 18:13:43 qroomcleaningbot app/web.1: request:
May 22 18:13:43 qroomcleaningbot app/web.1: Request {
May 22 18:13:43 qroomcleaningbot app/web.1: domain: null,
May 22 18:13:43 qroomcleaningbot app/web.1: _events: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _eventsCount: 5,
May 22 18:13:43 qroomcleaningbot app/web.1: _maxListeners: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: method: 'POST',
May 22 18:13:43 qroomcleaningbot app/web.1: simple: false,
May 22 18:13:43 qroomcleaningbot app/web.1: resolveWithFullResponse: true,
May 22 18:13:43 qroomcleaningbot app/web.1: forever: true,
May 22 18:13:43 qroomcleaningbot app/web.1: readable: true,
May 22 18:13:43 qroomcleaningbot app/web.1: writable: true,
May 22 18:13:43 qroomcleaningbot app/web.1: explicitMethod: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _qs: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _auth: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _oauth: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _multipart: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _redirect: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _tunnel: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _rp_resolve: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: _rp_reject: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: _rp_promise: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _rp_callbackOrig: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: callback: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: _rp_options: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: headers: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: setHeader: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: hasHeader: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: getHeader: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: removeHeader: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: localAddress: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: pool: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: dests: [],
May 22 18:13:43 qroomcleaningbot app/web.1: __isRequestRequest: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _callback: [Function: RP$callback],
May 22 18:13:43 qroomcleaningbot app/web.1: uri: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: proxy: null,
May 22 18:13:43 qroomcleaningbot app/web.1: tunnel: true,
May 22 18:13:43 qroomcleaningbot app/web.1: setHost: true,
May 22 18:13:43 qroomcleaningbot app/web.1: originalCookieHeader: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: _disableCookies: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _jar: undefined,
May 22 18:13:43 qroomcleaningbot app/web.1: port: 443,
May 22 18:13:43 qroomcleaningbot app/web.1: host: 'api.telegram.org',
May 22 18:13:43 qroomcleaningbot app/web.1: body: 'offset=592486038&timeout=10',
May 22 18:13:43 qroomcleaningbot app/web.1: path: '/bot514208409:AAGp8RZNjPzWBwiSnME4Mh8KjCfDFTIjx1E/getUpdates',
May 22 18:13:43 qroomcleaningbot app/web.1: httpModule: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: agentClass: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: agentOptions: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: agent: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: _started: true,
May 22 18:13:43 qroomcleaningbot app/web.1: href: 'https://api.telegram.org/bot514208409:AAGp8RZNjPzWBwiSnME4Mh8KjCfDFTIjx1E/getUpdates',
May 22 18:13:43 qroomcleaningbot app/web.1: req: [Object],
May 22 18:13:43 qroomcleaningbot app/web.1: ntick: true,
May 22 18:13:43 qroomcleaningbot app/web.1: response: [Circular],
May 22 18:13:43 qroomcleaningbot app/web.1: originalHost: 'api.telegram.org',
May 22 18:13:43 qroomcleaningbot app/web.1: originalHostHeaderName: 'host',
May 22 18:13:43 qroomcleaningbot app/web.1: responseContent: [Circular],
May 22 18:13:43 qroomcleaningbot app/web.1: _destdata: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _ended: true,
May 22 18:13:43 qroomcleaningbot app/web.1: _callbackCalled: true },
May 22 18:13:43 qroomcleaningbot app/web.1: toJSON: [Function: responseToJSON],
May 22 18:13:43 qroomcleaningbot app/web.1: caseless: Caseless { dict: [Object] },
May 22 18:13:43 qroomcleaningbot app/web.1: read: [Function],
May 22 18:13:43 qroomcleaningbot app/web.1: body: '<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body bgcolor="white">\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.12.2</center>\r\n</body>\r\n</html>\r\n' } }
I was also getting it and i'm catching and suppressing it now.
var telegram_error_handler = function(err) {
// Log.error("Telegram Error", JSON.stringify(err).substring(0, 100));
};
bot.on('polling_error', telegram_error_handler);
bot.on('webhook_error', telegram_error_handler);
nice __catch__ @sedhuait, will implement that!
Most helpful comment
I have the same problem.
Unhandled rejection Error: EPARSE: Error parsing Telegram response: <html><head><title>500 Internal Server Error</title></head><body bgcolor="white"><center><h1>500 Internal Server Error</h1></center><hr><center>nginx/1.12.2</center></body></html>