Naltox / telegram-node-bot

Node module for creating Telegram bots.
MIT License
721 stars 143 forks source link

Connection fails when uptime few days #110

Closed VitaliyR closed 7 years ago

VitaliyR commented 8 years ago

Hello there!

Bot hangs up in few days, throwing next logs.

Can I somehow catch it and reconnect again?

[error]
No network connection. Error: Error: getaddrinfo ENOTFOUND api.telegram.org api.telegram.org:443
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:79:26)
request TelegramApiRequest {
  _method: 'getUpdates',
  _params: { timeout: 50, offset: 687001302 },
  _multipart: undefined }

[log]
Retry request TelegramApiRequest {
  _method: 'getUpdates',
  _params: { timeout: 50, offset: 687001302 },
  _multipart: undefined }

[error]
api request error: Body: undefined
Error: SyntaxError: Unexpected token < in JSON at position 0
    at Object.parse (native)
    at IncomingMessage.response.on.e (/var/www/fspls_bot/node_modules/tiny_request/lib/network.js:68:38)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:973:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)
LBreda commented 8 years ago

https://github.com/Naltox/telegram-node-bot/issues/101

(tl;dr: not really solved, but updating to the last Node.js version helps)

bidadh commented 8 years ago

+1 Actually its not even few days! its few hours.

node version is 6.4.0

VitaliyR commented 8 years ago

@bidadh 👍 indeed. Few hours and dead end. No errors, no anything, just lost connection and that's it.

Naltox commented 7 years ago

lets move to #101