Closed Rommero closed 8 years ago
The investigation showed that the issue is causeb by multiple callback calls in dest function:
return through.obj(function (file, encoding, callback) {
I'll inform of any new info on the issue when i find out smth new
Thank you, I will fixed it tomorrow.
Some people say it's caused by the new version of ssh2 library. But the previous ones doesn't seem to help.
file.pipe(sftp.createWriteStream(outPath, options))
.on('error', done)
.on('finish', done)
function done (err) {
if (err) return end(err, callback)
gutil.log('Finished writing \'' + gutil.colors.cyan(outPath) + '\'')
callback()
}
The thing is the error event is emitted after the 'finish' one and is caused by gulp completing all the tasks (or by calling sftpClient.end() or ssh.end() manually). Therefore, calling done
second time causes the callback to be called twice resulting in an error.
Possible fix is checking whether the callback was called. I haven't find out yet why ending sftp session via end() method causes the error
I found out that ss2-streams library of ssh2 submodules caused this issue. Starting from v0.0.15 ssh2-streams has a bug, which causes such failures in other libs apart from gulp-ssh. So, the solution is to lock on ssh2-streams@0.0.14
@Rommero ssh2-streams released 0.0.17
@zensh 0.0.17 still contains the bug
@TXChetG "So, the solution is to lock on ssh2-streams@0.0.14" . I haven't tested gulp-ssh with the latest ssh2-streams@0.0.18 and ssh2-streams@0.0.19
Thanks @Rommero I didn't quite know what the meant until I read in another issue. I locked on to 0.0.15 and that alleviated my error. Maybe I'll give the two newer ones you suggested a try too.
Thanks again.
Gulp fails when trying to merge multiple streams of gulp-ssh.dest. Error "no writecb in Transform class" occurs when trying to run the following gulp-task (merging 1 stream for simplicity)
Here's the traceback.
I suppose there's a kinda bug in through2 library usage. I'll try to figure it out and report you via PR