1

I have a cronjob set up, which accesses a myslq database on a different server. The connection and data transfer work fine but everytime i get the following error:

node:events:342
      throw er; // Unhandled 'error' event
      ^
Error: write ECONNRESET
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:769:11)
    at Socket._write (node:net:781:8)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at Socket.Writable.write (node:internal/streams/writable:334:10)
    at onWrite (/root/newera/node_modules/ssh2/lib/client.js:305:16)
    at AESGCMCipherNative.Protocol._onWrite (/root/newera/node_modules/ssh2/lib/protocol/Protocol.js:116:33)
    at AESGCMCipherNative.encrypt (/root/newera/node_modules/ssh2/lib/protocol/crypto.js:333:10)
    at sendPacket (/root/newera/node_modules/ssh2/lib/protocol/utils.js:353:19)
    at Protocol.channelData (/root/newera/node_modules/ssh2/lib/protocol/Protocol.js:462:5)
    at Channel._write (/root/newera/node_modules/ssh2/lib/Channel.js:176:18)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at Channel.Writable.write (node:internal/streams/writable:334:10)
Emitted 'error' event on Client instance at:
    at Socket.<anonymous> (/root/newera/node_modules/ssh2/lib/client.js:745:12)
    at Socket.emit (node:events:365:28)
    at emitErrorNT (node:internal/streams/destroy:193:8)
    at emitErrorCloseNT (node:internal/streams/destroy:158:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'write',
  level: 'client-socket'
}

even though I have a try-catch statement in there the error isn't handled properly for some reason. If I start the script manually it works fine as well.

can anyone give me a hint what the issue might be? or maybe suggest an alternative to this way of doing it?

mles
  • 4,534
  • 10
  • 54
  • 94
Niklas
  • 11
  • 1

0 Answers0