Closed
Description
When bot gets this issue it does not react on any further commands. The simple restart of process helps.
Investigation: Have checked the code and figure out that it is trying to repeat the request later but it still fails
[TelegramBot]: Failed to get updates from Telegram servers
{ RequestError: Error: socket hang up
at new RequestError (/root/workspace/node-app/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/root/workspace/velas-god/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/root/workspace/node-app/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/root/workspace/node-app/node_modules/request/request.js:185:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/root/workspace/node-app/node_modules/request/request.js:877:8)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'RequestError',
message: 'Error: socket hang up',
cause:
{ Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1137:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at TLSSocket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
code: 'ECONNRESET',
path: null,
host: 'api.telegram.org',
port: 443,
localAddress: undefined },
error:
{ Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1137:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at TLSSocket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
code: 'ECONNRESET',
path: null,
host: 'api.telegram.org',
port: 443,
localAddress: undefined },
options:
{ proxy: null,
method: 'GET',
json: true,
formData: { timeout: 0, offset: 764361189, limit: 50 },
uri: 'https://api.telegram.org/..../getUpdates',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response: undefined }
Activity
ikerya commentedon Aug 7, 2020
The same here. I think, the issue isn't in his code. The problem has been appearing for the last week or two, approximately.
I have the same problem in different projects on different hostings, which are functioning in different countries.
Waiting for the fix. Thank you.
mast commentedon Aug 7, 2020
Is there any special reason you use GetUpdates message provider instead of WebHook?
GetUpdates method is issuing constant connections to Telegram servers even when there are no activity in your telegram bots/chats. Socket stays open until something happens, then messages are getting delivered and new connection is getting initiated. This works quite slow. It's not recommended for production envs and to be used during development/testing. WebHook thought works in the way, that telegram servers initiate connection to your bot when something is happening.
ikerya commentedon Aug 8, 2020
For webhooks a domain is needed. So it's
an inefficient way to create an independent bot.
But! If something doesn't work, it doesn't mean you should change the method... So no fixes..?
mast commentedon Aug 9, 2020
Is this reproducible with latest version of library? message delivery mechanics were refactored in 2.0.
Socket hangup on GetUpdates
mast commentedon Aug 10, 2020
Ok, I think I reproduced this problem and just delivered the fix. Checkout version 2.0.1.
Please reopen this ticket if you are able to reproduce with 2.0.1
ergcode commentedon Dec 2, 2020
I am sending two xlsx documents to two contacts.
The file comes to the first contact, and displays an error for the next contacts.