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

Question: how to make gulp-ssh compatible with ssh2 #1384

Closed
jcvignoli opened this issue Apr 18, 2024 · 5 comments
Closed

Question: how to make gulp-ssh compatible with ssh2 #1384

jcvignoli opened this issue Apr 18, 2024 · 5 comments
Labels

Comments

@jcvignoli
Copy link

Hi,
I'm a gulp-ssh user but unfortunately the package was abandonned a while ago. Gulp-ssh relies on ssh2 package. I don't understand javascript in general, so I'm trying to get info here to see if I can fix gulp-ssh.

With nodejs <= 19.9, I face no error when copying my files to my ssh server. When updating nodejs > 19.9 (so v20 and above), it randomly crashes for what it seems to be handshake-related. 90% of the uploads fail, I would say.

Here is the log when it fails, using "debug: console.log" in the config:

07:47:14] Starting 'stylesheets'...
Custom crypto binding not available
Local ident: 'SSH-2.0-ssh2js1.15.0'
Client: Trying [webserver removed] on port 22 ...
/assets/css/admin.min.css: 34
/assets/css/admin.min.css: 0
Socket error: 
[07:47:14] 'stylesheets' errored after 294 ms
[07:47:14] Error: Missing error message
    at new PluginError (/path/node_modules/plugin-error/index.js:64:11)
    at Client.<anonymous> (/path/node_modules/gulp-ssh/index.js:57:27)
    at Client.emit (node:events:519:28)
    at Client.emit (node:domain:488:12)
    at Socket.<anonymous> (/path/node_modules/ssh2/lib/client.js:807:12)
    at Socket.emit (node:events:519:28)
    at Socket.emit (node:domain:488:12)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Socket closed

and when it succeeds:

[07:47:17] Starting 'stylesheets'...
Custom crypto binding not available
Local ident: 'SSH-2.0-ssh2js1.15.0'
Client: Trying [webserver removed] on port 22 ...
/assets/css/admin.min.css: 34
/assets/css/admin.min.css: 0
Socket connected
Remote ident: 'SSH-2.0-OpenSSH_6.7p1'
Outbound: Sending KEXINIT
Inbound: Handshake in progress
Handshake: (local) KEX method: [email protected],curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512,ext-info-c,[email protected]
[ssh process removed]
[07:47:24] Finished writing '/path/assets/css/admin.min.css'
Outbound: Sending CHANNEL_CLOSE (r:0)
Outbound: Sending DISCONNECT (11)
[07:47:24] Finished 'stylesheets' after 7.31 s
Socket ended
Socket closed

I posted the specific gulp-ssh error there.

Anyone up to help me fix the gulp-ssh package? I know nothing about javascript... and got lost in trying to fix it myself.

@mscdex
Copy link
Owner

mscdex commented Apr 18, 2024

Judging by the debug output it looks like the socket isn't connecting at all. The default readyTimeout is currently set at 20 seconds, which includes the entire handshake. For the socket to not even connect within 20 seconds seems pretty unusual. There's not much I can help with that.

@jcvignoli
Copy link
Author

Thanks for the reply. I alredy tried to increase the readyTimeout, with no luck. Actually, it immediately failed to connect, and doesn't seem related to that variable.
Is there any further debug info I could provide?

@mscdex
Copy link
Owner

mscdex commented Apr 18, 2024

If it's immediately failing with a timeout message then that's something in node itself. Make sure you're specifying readyTimeout in milliseconds and not seconds.

Is there any further debug info I could provide?

Not really. Like I said, if the socket isn't even connecting then there's not much that can be done.

If you have access to the remote server you could look to see if there is a firewall or IDS or other security software blocking the connections.

@jcvignoli
Copy link
Author

jcvignoli commented Apr 18, 2024

If it's immediately failing with a timeout message then that's something in node itself. Make sure you're specifying readyTimeout in milliseconds and not seconds.

Already tried :(

If you have access to the remote server you could look to see if there is a firewall or IDS or other security software blocking the connections.

I don't have access but I strongly doubt it's server related. With nodejs 19.9 it works, with nodejs >= 20 it doesn't. Seems strange, but I don't know anything about nodejs.

Thanks for trying to help anyway.

@mscdex
Copy link
Owner

mscdex commented Apr 18, 2024

With nodejs 19.9 it works, with nodejs >= 20 it doesn't.

You can try filing an issue on the node repo and see if they can help.

@mscdex mscdex closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants