SharedKeyCredential不是构造函数-Azure Blob存储+ Nodejs

问题描述 投票:0回答:1

我正在尝试删除aucitonImages容器中的图像,但是当我从邮递员执行该功能时,我得到了SharedKeyCredential is not a constructor,我一直在关注documentation,我想我已经完成了所有设置,但是我没有看不到我的代码与文档有什么不同。感谢您的帮助!

app.delete("/api/removeauctionimages", upload, async (req, res, next) => {
  const { ContainerURL, ServiceURL, StorageURL, SharedKeyCredential } = require("@azure/storage-blob");
  const credentials = new SharedKeyCredential(process.env.AZURE_STORAGE_ACCOUNT, process.env.AZURE_STORAGE_ACCESS_KEY);
  const pipeline = StorageURL.newPipeline(credentials);
  const serviceURL = new ServiceURL(`https://${STORAGE_ACCOUNT_NAME}.blob.core.windows.net`, pipeline);
  const containerName = "auctionImages";
  const blobName = "myimage.png";



  const containerURL = ContainerURL.fromServiceURL(serviceURL, containerName);
  const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, blobName);
  await blockBlobURL.delete(aborter)
  console.log(`Block blob "${blobName}" is deleted`);

});
node.js azure azure-storage azure-storage-blobs
1个回答
0
投票
基于SDK版本12.1.0文档here,Microsoft似乎将here更改为SharedKeyCredential

您可以尝试吗?

© www.soinside.com 2019 - 2024. All rights reserved.