Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
解密凭据(NetSuite)时出错_Netsuite_Suitescript2.0 - Fatal编程技术网

解密凭据(NetSuite)时出错

解密凭据(NetSuite)时出错,netsuite,suitescript2.0,Netsuite,Suitescript2.0,我们想连接到SFTP服务器,但无法连接,NetSuite告诉我们解密凭据时出错。下面是我们的代码片段: var connection = sftp.createConnection({ username: 'XXXXXXXXX', passwordGuid: myPwdGuid, // references var myPwdGuid url: 'XXX.XXX.XXX.XXX', port : 22

我们想连接到SFTP服务器,但无法连接,NetSuite告诉我们解密凭据时出错。下面是我们的代码片段:

var connection = sftp.createConnection({
            username: 'XXXXXXXXX',
            passwordGuid: myPwdGuid, // references var myPwdGuid
            url: 'XXX.XXX.XXX.XXX',
            port : 22,
            hostKey: myHostKey // references var myHostKey
        });
下面是错误:

{“type”:“error.SuiteScriptError”,“name”:“解密密码GUID时发生错误”, “消息”:資格情報の復号中にエラーが発生しました。","堆栈“:[“createError(N/error)”, “main(/SuiteScripts/xxxx/xxxx/upload/uploadCsvFile.js:100)”, “原因”:{“类型”:“内部错误”,“代码”:“解密密码GUID时发生错误”, “详细信息”:資格情報の復号中にエラーが発生しました。","userEvent”:null,“stackTrace”:[“createError(N/error)”, “main(/SuiteScripts/xxxx/xxxx/upload/uploadCsvFile.js:100)”,“notifyOff”:false}, “id”:“”“notifyOff”:false,“userfaceting”:false}


我们错过了什么?谢谢

这可能会有所帮助。您是否使用添加凭据字段创建了密码GUID

通常创建的suitelet仅用于“保险存储”密码。响应是存储在代码或脚本参数中的密码GUID

下面的代码是一个脚本:

/**
 *@NApiVersion 2.x
 *@NScriptType Suitelet
 */


import * as runtime from 'N/runtime';
import * as ui from 'N/ui/serverWidget';


export function onRequest(context) {
    if (context.request.method === 'GET') {
        var me = runtime.getCurrentScript();
        var form = ui.createForm({
            title: 'SFTP Password'
        });

        form.addCredentialField({
            id : 'username',
            label : 'Pwd',
            restrictToDomains : <string>me.getParameter({name:'custscript_ksfp_vault_host'}),
            restrictToScriptIds : ['customscript_kotn_send_sftp'],
            restrictToCurrentUser : false
        });
        form.addSubmitButton({
            label: 'Submit Button'
        });

        context.response.writePage(form);
    } else {
        var textField = context.request.parameters.username;
        context.response.write('Store this GUID in the password parameter: ' + textField);
    }
}
/**
*@NApiVersion 2.x
*@NScriptType Suitelet
*/
从“N/runtime”导入*作为运行时;
从“N/ui/serverWidget”导入*作为ui;
导出函数onRequest(上下文){
if(context.request.method=='GET'){
var me=runtime.getCurrentScript();
var form=ui.createForm({
标题:“SFTP密码”
});
form.addCredentialField({
id:'用户名',
标签:“Pwd”,
restrictToDomains:me.getParameter({name:'custscript\u ksfp\u vault\u host'}),
RestrictToScriptId:['customscript\u kotn\u send\u sftp'],
restrictToCurrentUser:false
});
form.addSubmitButton({
标签:“提交按钮”
});
context.response.writePage(表单);
}否则{
var textField=context.request.parameters.username;
context.response.write('将此GUID存储在密码参数中:'+textField);
}
}

您是如何获取myPwdGuid中的值的?我的同事似乎使用了Suitelet来获取此guid。当我检查代码“是”时,添加了一个“添加凭据”字段。代码也使用相同的参数。我可以共享他们用于获取提供给我的guid的代码。