【发布时间】:2020-05-01 01:13:06
【问题描述】:
我创建了一个新的 Azure 存储帐户。在其中我有一个 blob 容器,其访问类型设置为“私有”。以下是我尝试创建容器的 nodejs 代码。
var azure = require('azure-storage');
var accountName = "xxxxxxxxxx";
var accessKey = "veryLongAccessKey";
var host = "https://abc.blob.core.windows.net";
var blobSvc = azure.createBlobService(accountName, accessKey, host);
blobSvc.createContainerIfNotExists('myblobContainer', function(error, result, response) {
console.log("error");
console.log(error);
console.log("result");
console.log(result);
console.log("response");
console.log(response);
});
当我执行此代码时,出现以下错误。
{ Error: unable to verify the first certificate
at Error (native)
at TLSSocket.<anonymous> (_tls_wrap.js:1062:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket._finishInit (_tls_wrap.js:586:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:416:38) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }
我错过了什么?
【问题讨论】:
-
我用我的一个存储帐户尝试了您的代码,但无法重现错误。你能分享更多细节吗?比如你使用的是什么版本的 Node SDK?图片中是否有代理/防火墙?您是否自定义了节点设置?
-
节点 6.9.1。没有防火墙。我没有做任何特殊的节点设置。上面的代码是否创建了一个blob容器?
-
问题出在主机名中的 httpS。我放了http。
-
如果使用http,响应可以被中间任何第三方拦截。我强烈建议您修复证书问题,并使用 HTTPS。