我試圖做出HTTPS請求 - 承諾。我已經知道PFX是好的,這不是問題(我有一個類似的示例應用程序工作)。Node.js - HTTPS PFX錯誤:無法加載BIO
我做了以下內容:
var request = require('request-promise');
...
options.pfx = fs.readFileSync('myfile.pfx');
options.passphrase = 'passphrase';
我通過我的選項爲請求。
request.post(options);
然後我嘗試建立我得到以下錯誤請求:
_tls_common.js:130
c.context.loadPKCS12(pfx, passphrase);
^
Error: Unable to load BIO
at Error (native)
at Object.createSecureContext (_tls_common.js:130:17)
at Object.exports.connect (_tls_wrap.js:955:21)
at Agent.createConnection (https.js:73:22)
at Agent.createSocket (_http_agent.js:174:16)
at Agent.addRequest (_http_agent.js:143:23)
at new ClientRequest (_http_client.js:133:16)
at Object.exports.request (http.js:31:10)
at Object.exports.request (https.js:163:15)
at Request.start (/Users/filomeno/workspace/sla-crawler/node_modules/request/request.js:747:30)
at Request.write (/Users/filomeno/workspace/sla-crawler/node_modules/request/request.js:1369:10)
at end (/Users/filomeno/workspace/sla-crawler/node_modules/request/request.js:561:16)
at Immediate._onImmediate (/Users/filomeno/workspace/sla-crawler/node_modules/request/request.js:589:7)
at processImmediate [as _immediateCallback] (timers.js:374:17)
我有一個示例應用程序在相同的代碼工作。 我試圖轉換爲.p12沒有成功。
有沒有人知道這個錯誤可能指的是什麼?
編輯: 我使用lodash做2個對象與DINAMIC屬性和靜態屬性
_.merge(options, _this.requestOptions);
這的合併是造成問題
你有什麼發現?我得到了完全相同的錯誤 –
此代碼與「相同代碼有效」的示例應用程序有什麼不同? _I.e._是由不同用戶運行的兩個應用程序(在'myfile.pfx'文件中建議文件系統權限)?有問題的PFX文件是否使用相同的密碼來保護容器**和**私鑰或不同的密碼? – Castaglia
我的問題是lodash我正在做'_.merge(options,_this.requestOptions); '這與我的編碼混亂。 – fasantos