gpt4 book ai didi

javascript - 使用 Node.js 将文件上传到 Netsuite

转载 作者:搜寻专家 更新时间:2023-10-31 23:41:09 25 4
gpt4 key购买 nike

所以我正在测试 npm 模块附带的脚本,该模块会将 NetSuite 文件上传到文件柜。 这是一个指向名为 nsupload 的 npm 模块的链接。说明书上说要把模块中包含的ReSTLet上传到Netsuite中,在Netsuite中的PUT方法中设置RESTlet中的函数。当我在我这边运行脚本以将文件上传到 Netsuite 文件柜时,我收到错误消息“TypeError:sendToNetsuite 不是一个函数。”

这是模块提供的测试代码:

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);
});

编辑:我将我使用的 npm 模块更改为名为 nscabinet 的模块。这个 stoo 附带了一个用于将文件上传到 Netsuite 的示例代码。这是代码:

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
}))

我遗漏了一些参数,但我认为它们没有什么不同。目前,我一直收到的错误是“SSS_INVALID_SCRIPTLET_ID - That Suitelet is invalid, disabled, or no longer exists.”我也将它附带的 ReSTLet 上传到 Netsuite,但问题仍然存在。

同样,我已经查找了错误,但我仍然没有弄清楚问题是什么。我尝试在我想使用的代码中测试代码,并在它不起作用时单独测试代码。有解决这个问题的想法吗?

谢谢!

最佳答案

将您的 script 选项更改为您上传到 NetSuite 的 ReSTLet 的 script id。

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
}))

关于javascript - 使用 Node.js 将文件上传到 Netsuite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39737567/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com