Skip to content

Response inconsistent on IIS #64

@SquaredMelon

Description

@SquaredMelon

I am experiencing inconsistent behavior in the response of the remote SFTP server between the development machine and the production machine.

var ftpConf: {
        host: 'SFTP.____.IT', 
        username: '____', 
        password: '____',
        protocol: 'sftp',
        port: 22,
        escape: true,
        retries: 2, 
        timeout: 10, 
        retryInterval: 5,
        retryMultiplier: 1, 
        requiresPassword: true,
        autoConfirm: true,
        cwd: '', 
        directoryRemotaLotti: '/RX'
    },
var pathfileLotto = req.body.LottoFile;
var fileLottoName = pathfileLotto.substr(pathfileLotto.lastIndexOf('/')+1,pathfileLotto.length);
var fileLottoRename= fileLottoName.replace(".tmp", ".lat");
var ftps = new FTPS(config.ftpConf);
ftps
            .cd(config.ftpConf.directoryRemotaLotti)
            .addFile(pathfileLotto)
            .exec(function (err, result) {
                console.log('ERR=', err, 'RES=', result);
                if (!result.error) {
                    //res.json('OK')
                    ftps
                        .cd(config.ftpConf.directoryRemotaLotti)
                        .mv(fileLottoName, fileLottoRename)
                        .exec(function (err, result) {
                            console.log('ERR=', err, 'RES=', result);
                            if (!result.error) {
                                res.json('OK')
                            }
                            else {
                                res.status(500).json(err)
                            }
                            // err will be null (to respect async convention)
                            // res is an hash with { error: stderr || null, data: stdout }
                        });
                }
                else {
                    res.status(500).json(err)
                }
                // err will be null (to respect async convention)
                // res is an hash with { error: stderr || null, data: stdout }
            });

In DEV machine result in exec function return no error, in PROD machine return an error but the file is uploaded with success.

[____ for privacy]

ERR= null RES= { error: '2018-03-02 09:56:32 /cygdrive/e//../DocumentiComuni//2018/SS/FTA/P_SS_20180302-095549.tmp -> sftp://@sftp..IT:22/RX/P_SS_20180302-095549.tmp 0-1599438 627.5 KiB/s\n',
data: '' }

The PROD machine is a IIS 7.5 with iisnode on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions