繁体   English   中英

Azure Blob 存储上传无法上传多个文件

[英]Azure Blob Storage upload failing to upload multiple files

我正在使用 blockBlobClient 上传多个文件。 当我有少量文件时它会起作用,但当我有很多文件(~50-100+ 文件)时它不起作用。 我假设它正在超过连接限制。

if (!files.length) return []
  try {
    console.log('length of files: ', files.length)
    files.map(async file=> {
      return await uploadToBlob(file);
    })

然后我有这个上传到 blob 存储的 uploadToBlob function

  const containerClient = await createBlobContainer(
    blobServiceClient,
    containerName
  );

  const blockBlobClient = containerClient.getBlockBlobClient(
    blobName
  );

  const uploadBlobResponse = await blockBlobClient.upload(
    content, 
    Buffer.byteLength(content)
  );

  console.log(`Upload block blob ${blobName} successfully. Request id: `, uploadBlobResponse.requestId);
  return uploadBlobResponse;
};

错误是500

Server encountered an internal error. Please try again after some time

const error = new RestError(

RestError: Server encountered an internal error. Please try again after some time.
RequestId:e78657e8-6ad9-452e-a7b3-6361a6c4972d
Time:2022-11-02T13:06:02.2715094Z
    at handleErrorResponse (/usr/src/app/node_modules/@azure/core-http/src/policies/deserializationPolicy.ts:274:17)
    at /usr/src/app/node_modules/@azure/core-http/src/policies/deserializationPolicy.ts:179:47
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async StorageRetryPolicy.attemptSendRequest (/usr/src/app/node_modules/@azure/storage-blob/src/policies/StorageRetryPolicy.ts:169:18)
    at async StorageClientContext.sendOperationRequest (/usr/src/app/node_modules/@azure/core-http/src/serviceClient.ts:521:23)
    at async BlockBlobClient.upload (/usr/src/app/node_modules/@azure/storage-blob/src/Clients.ts:3824:14) {
  code: 'InternalError',
  statusCode: 500,

任何帮助将不胜感激

我尝试做一些块,但问题仍然再次发生。

  • 除了使用clientContainer ,我们还可以使用azcopy

  • Azcopy是azure提供的用于数据传输的命令行工具。 你可以在这里下载。 如果您使用的是 windows,它将为您提供一个 zip 文件,将此文件解压缩到一个文件夹中,并将解压缩文件的地址添加到路径变量中。

  • 然后你可以运行下面的命令

azcopy login

这将提示您登录。 在这里确保您已将数据贡献者角色添加到您的帐户。

  • 然后你可以运行下面的命令
az copy <path to you folder or file> "<url of your container>"

在 azcopy 上参考此MS DOC

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM