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

Response inconsistent on IIS #64

Open
SquaredMelon opened this issue Mar 2, 2018 · 0 comments
Open

Response inconsistent on IIS #64

SquaredMelon opened this issue Mar 2, 2018 · 0 comments

Comments

@SquaredMelon
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant