After the bot is running smoothly for some hours (usually 1 day or so) it will stop responding to commands and spam the logs with these errors:
I am using OpenVPN and and a internet connection that restarts itself every 24 which might be the problem I think. Any advice what I would need to change to avoid restarting every 24h via cron?
name: 'NetworkError',
stack: 'NetworkError: getUpdates failed: Error: getaddrinfo EAI_AGAIN api.telegram.org:443\n at new NetworkError (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:20:20)\n at ClientRequest.handleResponse (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:133:24)\n at emitOne (events.js:121:20)\n at ClientRequest.emit (events.js:211:7)\n at TLSSocket.socketErrorListener (_http_client.js:401:9)\n at emitOne (events.js:116:13)\n at TLSSocket.emit (events.js:211:7)\n at emitErrorNT (internal/streams/destroy.js:66:8)\n at args.(anonymous function) (/usr/local/lib/nodejs/node-v8.15.0/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)\n at _combinedTickCallback (internal/process/next_tick.js:139:11)\nWhen calling method getUpdates: { offset: 273312714, timeout: 600 }\n at Bot.callMethod (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:102:18)\n at Bot.consumeUpdates (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:201:8)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)',
message: 'getUpdates failed: Error: getaddrinfo EAI_AGAIN api.telegram.org:443',
err:
{ Error: getaddrinfo EAI_AGAIN api.telegram.org:443
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'api.telegram.org',
host: 'api.telegram.org',
port: 443 },
req:
{ Error: When calling method getUpdates: { offset: 273312714, timeout: 600 }
at Bot.callMethod (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:102:18)
at Bot.consumeUpdates (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:201:8)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)
method: 'getUpdates',
parameters: { offset: 273312714, timeout: 600 },
message: 'When calling method getUpdates: { offset: 273312714, timeout: 600 }' } }
Error when updating: { NetworkError: getUpdates failed: Error: getaddrinfo EAI_AGAIN api.telegram.org:443
at new NetworkError (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:20:20)
at ClientRequest.handleResponse (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:133:24)
at emitOne (events.js:121:20)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:401:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:66:8)
at args.(anonymous function) (/usr/local/lib/nodejs/node-v8.15.0/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
When calling method getUpdates: { offset: 273312714, timeout: 600 }
at Bot.callMethod (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:102:18)
at Bot.consumeUpdates (/home/dietpi/shell-bot/node_modules/botgram/lib/bot.js:201:8)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)
I also checked if I have any webhooks attached to the bot but it does not seem to be the case:
https://api.telegram.org/bot<token>/deleteWebhook
{"ok":true,"result":true,"description":"Webhook is already deleted"}