ExploreConsulting / netsuite-sync

Syncs file to the NS file cabinet - great for uploading suitescripts
15 stars 13 forks source link

TypeError: Cannot read property 'writeResponse' of undefined #11

Closed philip-denys closed 4 years ago

philip-denys commented 4 years ago

TypeError: Cannot read property 'writeResponse' of undefined at /Users/philipdenys/.npm/lib/node_modules/netsuite-sync/ns.js:69:49

if (program.upload) {
    fileCabinet.postFile(program.upload, program.desc, program.folder, function (err, resp) {

        if (err) throw err;

        debug('response from NS cabinet add: %s', JSON.stringify(resp))

        var wr = resp.Envelope.Body.addResponse.writeResponse;
        if (wr.status.isSuccess == "true") {
            var successMsg = "File uploaded successfully as internalid " + wr.baseRef.internalId;
            console.log(chalk.green(successMsg));
        }
        else {
            var failMsg = "Problem uploading file" + JSON.stringify(wr);
            console.error(chalk.red(failMsg));
        }
    });
}

is this due to a netsuite feature that hasn't been checked?

ShawnTalbert commented 4 years ago

Hello, this sort of error can happen if NS returns invalid SOAP (sometimes it returns a web page instead of a legit SOAP response).

This utility isn't being supported since the nodejs SDF CLI has been available for free from netsuite for quite some time now. https://github.com/oracle/netsuite-suitecloud-sdk

Somehow this netsuite-sync utility is still much faster but the official suitecloud SDK supports the latest NS features including token based and 2FA authentication.

philipdenys commented 4 years ago

Yeah I managed to setup the new cli And it is a much better and stable tool

Tnx anyway