简体   繁体   中英

Uploading a file to Netsuite using Node.js

So I am testing out a script that comes with an npm module that will upload a NetSuite file to the File Cabinet. Here is a link to the npm module called nsupload . The instructions say to upload the Restlet included in the module to Netsuite and set the function in the RESTlet in the PUT method in Netsuite. When I run the script on my end to upload a file to the Netsuite File Cabinet I get the error "TypeError: sendToNetsuite is not a function."

Here is the test code the module supplies:

var sendToNetsuite = require('nsupload')
  .config({
    email: 'email',
    password: 'pass',
    account: 'account number',
    script: 'script number',
    method: 'PUT'
  });

sendToNetsuite('./foo.json', function(err, body) {
  console.log('Success!');
  console.log(body);
});

I changed the npm module I was using to the one called nscabinet . 我将我正在使用的npm模块更改为名为nscabinet的模块This stoo came with a sample code for uploading a file to Netsuite. Here's the code to that:

var nscabinet = require('nscabinet') ,
gulp = require('gulp') //or just vinyl-fs 


gulp.src('foo.js')
    .pipe(nscabinet({
        email : 'foo@bar.baz.com' ,
        password : '123456' ,
        account : '123456' ,
       // realm : 'sandbox.netsuite.com' ,
        //role : 3 ,
        rootPath : '/SuiteScripts',
        script : 'myuploadfile' ,
        deployment : 2
    }))

I left out a few parameters but I don't believe they make a difference. At the moment the error I keep getting is "SSS_INVALID_SCRIPTLET_ID - That Suitelet is invalid, disabled, or no longer exists." I have upload the Restlet that came with it to Netsuite as well but the problem persists.

Again, I have looked up the error but I still haven't figured out what the problem is. I tried testing the code within the code I wanted to use and by itself when it didn't work. Any ideas on solving this?

Thanks!

Change your script option to the script id of the Restlet you uploaded to NetSuite.

gulp.src('foo.js')
.pipe(nscabinet({
    email : 'foo@bar.baz.com' ,
    password : '123456' ,
    account : '123456' ,
   // realm : 'sandbox.netsuite.com' ,
    //role : 3 ,
    rootPath : '/SuiteScripts',
    script : 1234 ,
    deployment : 2
}))

Output console.log(inspect(sendToNetsuite)); It is not defined or not a function. The repo is private here https://github.com/truecloud-com/nsupload -- maybe contact TrueCloud/Netsuite whatever.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM