gtg092x / gulp-sftp

Gulp SFTP Deploy
140 stars 61 forks source link

Always get "SFTP session ended early" error #38

Closed pghalliday closed 8 years ago

pghalliday commented 8 years ago

Files seem to be uploaded successfully but then I always get this error

[12:17:17] Using gulpfile ~/projects/my-app/gulpfile.js
[12:17:17] Starting 'default'...
[12:17:18] Authenticating with private key.
[12:17:18] gulp-sftp: Uploaded: index.html => /usr/share/nginx/html/my-app/index.html
[12:17:18] gulp-sftp: Uploaded: jquery-1.10.2.min.js => /usr/share/nginx/html/my-app/jquery-1.10.2.min.js
[12:17:18] gulp-sftp: Uploaded: thinClient.js => /usr/share/nginx/html/my-app/thinClient.js
[12:17:18] gulp-sftp: 3 files uploaded successfully
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: SFTP session ended early
    at SFTPStream._cleanup (/home/pghalliday/projects/my-app/node_modules/gulp-sftp/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:188:15)
    at SFTPStream.end (/home/pghalliday/projects/my-app/node_modules/gulp-sftp/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:160:8)
    at SFTPWrapper.end (/home/pghalliday/projects/my-app/node_modules/gulp-sftp/node_modules/ssh2/lib/SFTPWrapper.js:29:23)
    at Transform._flush (/home/pghalliday/projects/my-app/node_modules/gulp-sftp/index.js:319:23)
    at Transform.<anonymous> (/home/pghalliday/projects/my-app/node_modules/gulp-sftp/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:135:12)
    at Transform.g (events.js:260:16)
    at emitNone (events.js:72:20)
    at Transform.emit (events.js:166:7)
    at finishMaybe (/home/pghalliday/projects/my-app/node_modules/gulp-sftp/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:371:12)
    at afterWrite (/home/pghalliday/projects/my-app/node_modules/gulp-sftp/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:291:5)

I'm using version 0.1.4 of gulp-sftp and it installed version 0.4.11 of ssh2. Sounded similar to the SFTP abrupt closure error (although my files are tiny) so i also tried {buffer: false} in the gulp.src call but it didn't make any difference.

This is my gulpfile:

var gulp = require('gulp');
var sftp = require('gulp-sftp');

gulp.task('default', function() {
  return gulp.src('src/*', {buffer: false})
    .pipe(sftp({
      host: '10.0.0.10',
      user: 'root',
      remotePath: '/usr/share/nginx/html/my-app/'
    }));
});

The server is a Ubuntu 14.04 LEMP stack running on Digital Ocean

Any thoughts?

tplessis commented 8 years ago

Hey, same trouble for me!

gulp.task('upload', function () {
  return gulp.src('assets/**/*')
    .pipe(sftp({
      host: '******',
      user: '****',
      password: '*******',
      remotePath: '../../web/assets/'
    }));
});
builtbylane commented 8 years ago

ditto. this is likely due to updates in ssh2-streams or ssh2

mwickett commented 8 years ago

I'm also getting an SFTP abrupt closure response.

tplessis commented 8 years ago

Fixed for me on 0.1.5, i think you can closed. :)

gtg092x commented 8 years ago

Hey all - similar issue. SSh2 did an update that broke this module. Locking in a previous version fixed it.

gowram commented 8 years ago

I was still facing this issue with my windows system.

pb-cheung commented 8 years ago

which version? @gtg092x