node-telegram-bot-api
node-telegram-bot-api copied to clipboard
Socket Hang up
error: { Error: socket hang up at createHangUpError (_http_client.js:254:15) at TLSSocket.socketOnEnd (_http_client.js:346:23) at emitNone (events.js:91:20) at TLSSocket.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9) code: 'ECONNRESET' }
Can any one help me to understand why this happening
+1
+1
In my case it was
const stream = fs.createReadStream(filename)
It was enough to close the stream after sending and the error disappeared
bot.sendPhoto(msg.chat.id, stream).finally(() => stream.close())