{"action":"created","issue":{"url":"https://api.github.com/repos/theophilusx/ssh2-sftp-client/issues/195","repository_url":"https://api.github.com/repos/theophilusx/ssh2-sftp-client","labels_url":"https://api.github.com/repos/theophilusx/ssh2-sftp-client/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/theophilusx/ssh2-sftp-client/issues/195/comments","events_url":"https://api.github.com/repos/theophilusx/ssh2-sftp-client/issues/195/events","html_url":"https://github.com/theophilusx/ssh2-sftp-client/issues/195","id":537221478,"node_id":"MDU6SXNzdWU1MzcyMjE0Nzg=","number":195,"title":"Unhandled 'error' event when calling end()","user":{"login":"rwolthuis","id":20732570,"node_id":"MDQ6VXNlcjIwNzMyNTcw","avatar_url":"https://avatars1.githubusercontent.com/u/20732570?v=4","gravatar_id":"","url":"https://api.github.com/users/rwolthuis","html_url":"https://github.com/rwolthuis","followers_url":"https://api.github.com/users/rwolthuis/followers","following_url":"https://api.github.com/users/rwolthuis/following{/other_user}","gists_url":"https://api.github.com/users/rwolthuis/gists{/gist_id}","starred_url":"https://api.github.com/users/rwolthuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwolthuis/subscriptions","organizations_url":"https://api.github.com/users/rwolthuis/orgs","repos_url":"https://api.github.com/users/rwolthuis/repos","events_url":"https://api.github.com/users/rwolthuis/events{/privacy}","received_events_url":"https://api.github.com/users/rwolthuis/received_events","type":"User","site_admin":false},"labels":[{"id":1512965666,"node_id":"MDU6TGFiZWwxNTEyOTY1NjY2","url":"https://api.github.com/repos/theophilusx/ssh2-sftp-client/labels/more%20info","name":"more info","color":"f9d0c4","default":false,"description":"More details required. Waiting on additional information from OP"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2019-12-12T21:24:55Z","updated_at":"2019-12-21T23:51:31Z","closed_at":null,"author_association":"NONE","body":"Versions:\r\nNodeJS: v12.13.1\r\nssh2-sftp-client - 4.3.0\r\n\r\nAs the title already says, everytime I call the client.end() function, the application throws an error which I cannot seem to catch. Note that before I call the end function, I am able to connect, upload a file, list the remote directory and download a file. All of these actions succeed as expected.\r\n\r\nThe error i'm getting:\r\nevents.js:187\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\n\r\nError: read ECONNRESET\r\n    at TCP.onStreamRead (internal/stream_base_commons.js:201:27)\r\nEmitted 'error' event on Client instance at:\r\n    at Socket.<anonymous> (/home/energyio/node_modules/ssh2/lib/client.js:307:10)\r\n    at Socket.emit (events.js:210:5)\r\n    at emitErrorNT (internal/streams/destroy.js:92:8)\r\n    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\r\n    at processTicksAndRejections (internal/process/task_queues.js:80:21) {\r\n  errno: 'ECONNRESET',\r\n  code: 'ECONNRESET',\r\n  syscall: 'read',\r\n  level: 'client-socket'\r\n}\r\n\r\nI tried to catch the error using try/catch blocks and by listening for errors on the sftp client aswell as the ssh 'client' (ssh2 object) inside the sftp object. Neither works.\r\n\r\nMaybe it's good to mention that I'm connecting to an Azure SFTP server. I don't have any other SFTP servers to my disposal to test against. The error is thrown using the example code on git aswel as my own implementation.\r\n\r\nDid anyone face the same problem or maybe know the solution to this problem?"},"comment":{"url":"https://api.github.com/repos/theophilusx/ssh2-sftp-client/issues/comments/568220691","html_url":"https://github.com/theophilusx/ssh2-sftp-client/issues/195#issuecomment-568220691","issue_url":"https://api.github.com/repos/theophilusx/ssh2-sftp-client/issues/195","id":568220691,"node_id":"MDEyOklzc3VlQ29tbWVudDU2ODIyMDY5MQ==","user":{"login":"theophilusx","id":1594409,"node_id":"MDQ6VXNlcjE1OTQ0MDk=","avatar_url":"https://avatars0.githubusercontent.com/u/1594409?v=4","gravatar_id":"","url":"https://api.github.com/users/theophilusx","html_url":"https://github.com/theophilusx","followers_url":"https://api.github.com/users/theophilusx/followers","following_url":"https://api.github.com/users/theophilusx/following{/other_user}","gists_url":"https://api.github.com/users/theophilusx/gists{/gist_id}","starred_url":"https://api.github.com/users/theophilusx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theophilusx/subscriptions","organizations_url":"https://api.github.com/users/theophilusx/orgs","repos_url":"https://api.github.com/users/theophilusx/repos","events_url":"https://api.github.com/users/theophilusx/events{/privacy}","received_events_url":"https://api.github.com/users/theophilusx/received_events","type":"User","site_admin":false},"created_at":"2019-12-21T23:51:31Z","updated_at":"2019-12-21T23:51:31Z","author_association":"OWNER","body":"Version 4.3.1 has been pushed to npmjs.com. I expect it has resolved the issue with errors causing uncaught exception issues. However, if Azure is causing ssh2 or ssh2streams to throw an error when ending a connection, there is not much I can do about that (you would need to handle/ignore that error in your code). "}}
{"actor":{"display_login":"theophilusx"}}