Skip to content

Unhandled rejection Error: 502 #377

@kekkokk

Description

@kekkokk

Expected Behavior

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!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions