gpt4 book ai didi

html - Angular,Azure.CreateBlobService 未读取传入的环境变量或值?

转载 作者:行者123 更新时间:2023-12-05 07:35:02 27 4
gpt4 key购买 nike

我正在使用 Azure Blob 服务库中的此函数:https://azure.github.io/azure-storage-node/global.html#createBlobService

但它不允许我这样做,当在environment.ts中指定环境变量时,它会抛出此错误:错误错误:创建服务客户端时必须提供凭据。

当尝试传入 ConnectionString 时,它会抛出此错误:ERROR TypeError: crypto.createHmac is not a function

  var azure = require('azure-storage');
var bs = azure.createBlobService();
bs.createContainerIfNotExists('taskcontainer', {
publicAccessLevel: 'blob'
}, function(error, result, response) {
if (!error) {
console.log("True");
// if result = true, container was created.
// if result = false, container already existed.
}
});

以前有人遇到过这个问题吗?很高兴看到解决方案

最佳答案

您应该提供帐户名和存储 key ,如下所示:

var blobService = azure.createBlobService(environment.storage_account_name, environment.storage_key);

关于html - Angular,Azure.CreateBlobService 未读取传入的环境变量或值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49790718/

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