gulp 4 vinyl-ftp Unable to make data connection

667 Views Asked by At

I'm facing problem with uploading files, randomly it stops with different kind of errors: Unable to make data connection at Socket. (/aaa/node_modules/ftp/lib/connection.js:935:10) or Error: Client aborted. Sometimes it works when launched e.g. 10 times

var deployPaths =
{
    'aaa/public_html': [],
    'bbb/public_html': [],
};

var defaultTasks = [];

function deployMultiple(key) {

    var conn = ftp.create({
        host: 'site',
        user: 'xxxx',
        password: 'xxxxxx',
        parallel: 10,
        maxConnections: 5,
        log: plugins.util.log
    });

    var globs = [

        path + '/some_path/**',
        '!' + path + '/some_path/aa/**',
        '!' + path + '/some_path/bb/**',
        path + '/administrator/some_path/**',

    ];

    // using base = '.' will transfer everything to /public_html correctly
    // turn off buffering in gulp.src for best performance
    return gulp.src(globs, {base: path, buffer: false})
        .pipe(conn.newer(key)) // only upload newer files
        .pipe(conn.dest(key));


}

gulp.task('deploy-task', function (cb) {
    for (var key in deployPaths) {
        deployMultiple(key);
        cb();
    }

});

gulp.task('deploy',gulp.series('clean','git_export','deploy-task'));

Please help, Thank you

1

There are 1 best solutions below

0
On

@miojamo

I tested my upload with the same error against 2 different hosting providers with vinyl-ftp and FileZilla and found that this the error happens only for one of the providers.

In short:

  • This is more likely to happen with very long uploads (~22,000 files in my case) due to the error on a provider's side.
  • At the same time being tested at another provider gives the other error (Timed out while making data connection...) instead of Unable to make data connection....

See my detailed explanations here in vinyl-ftp Github repo issue.

Hope that sheds some more light on the issue.