Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: connect: Unexpected end event #568

Open
ankit2049 opened this issue Jan 27, 2025 · 3 comments
Open

Error: connect: Unexpected end event #568

ankit2049 opened this issue Jan 27, 2025 · 3 comments

Comments

@ankit2049
Copy link

This error is crashing the server. I am on version 11.0.0

connect() calls addTempListeners(this, 'connect') without a reject argument

Inside the connect method, we have this line:

listeners = addTempListeners(this, 'connect');

However, the 'getConnection' call does pass the reject, so if the SSH2 'end' event fires during getConnection, it correctly calls reject(newError), turning into a Promise rejection.

Is there any specific reason it is designed in such a way? Can we do something like this:

listeners = addTempListeners(this, 'connect', (err) => {
      throw this.fmtError(err, 'connect');
});
@theophilusx
Copy link
Owner

theophilusx commented Jan 27, 2025 via email

@MrNghia123
Copy link

I am having the exact problem.
Do you have any workaround @ankit2049 ?

@bboltze
Copy link

bboltze commented Feb 15, 2025

I think I might have the same issue when using the ssh hostVerifier options.
When the verifier returns false, connect() simply hangs. Using getConnection() followed by getSftpChannel() works as expected, i.e. the getConnection() Promise is rejected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants