Azurite icon indicating copy to clipboard operation
Azurite copied to clipboard

Azurite doesn’t support error "CannotVerifyCopySource" in Copy Blob From URL operation on blob

Open zzhxiaofeng opened this issue 5 years ago • 8 comments

Error Description: In Azure, it will return error "CannotVerifyCopySource" when use Copy Blob From URL operation with invalid blob url. But in Azurite, it copy blob successfully in this case. Azure error is shown as following: Screenshot 2020-11-19 145100

To Reproduce

import {
  BlobServiceClient
} from "@azure/storage-blob";
import * as assert from "assert"

async function main() {
  const blobServiceClient = await BlobServiceClient.fromConnectionString("Azurite-https-connectionString");
  const containerClient = await blobServiceClient.getContainerClient("<container-name>");
  const originBlobClient = await containerClient.getBlockBlobClient("<origin-blob-name>");
  const newBlobClient = await containerClient.getBlockBlobClient("<new-blob-name>");
  try{
    await newBlobClient.syncCopyFromURL(originBlobClient.url);
  }catch(err){
    console.log(err);
    assert.ok((err as any).response.parsedBody.Code === "CannotVerifyCopySource");
  }
}

main();

Error Track The reason maybe is that the copyFromURL handler method lacks the error handler for "CannotVerifyCopySource" The copyFromURL handler method is defined in https://github.com/Azure/Azurite/blob/master/src/blob/handlers/BlobHandler.ts#L801 The startCopyFromURL handler method have the error handler which is defined in https://github.com/Azure/Azurite/blob/master/src/blob/handlers/BlobHandler.ts#L647

Expected Behavior When use Copy Blob From URL operation with invalid blob url, it doesn't copy blob successfully and return error "CannotVerifyCopySource" in Azurite.

@jongio for notification.

zzhxiaofeng avatar Nov 18 '20 09:11 zzhxiaofeng

@zzhxiaofeng Thanks for raising the issue!

For different error, it's better to open different git hub issues to track them. As we already have https://github.com/Azure/Azurite/issues/603to track issue #2, will only use this to track #1.

It would be great if you can include the current Azurite behavior of #1 to this issue, then we can know the severity of the issue. We will investigate and evaluate the issue.

We welcome contribution to Azurite. It would be great if you could contribute the the fix of this issue.

blueww avatar Nov 19 '20 03:11 blueww

@blueww Ok, I have updated the error description. Please have a look.

zzhxiaofeng avatar Nov 19 '20 06:11 zzhxiaofeng

Thanks for the reply @zzhxiaofeng! For "return nothing in Azurite", do you mean Azurite will not return error, also not return any responds? Could you please clarify?

BTW, for Azurite issue, it's better to attach the debug log for the related request. For Azurite behavior different with Azure Server, beside debug log, please also describe clearly the different behavior of both Azurite and Azure server?

blueww avatar Nov 19 '20 08:11 blueww

@blueww When use Copy Blob From URL operation with invalid blob url, it will return the error "CannotVerifyCopySource" in Azure Server. But in Azurite, it don't return the error and run successfully(return 200) in this case.

zzhxiaofeng avatar Nov 20 '20 02:11 zzhxiaofeng

@zzhxiaofeng Thanks for the details! We will evaluate it.

blueww avatar Nov 20 '20 03:11 blueww

azsdk-azurite

v-xuto avatar May 17 '21 06:05 v-xuto

This is still happening when copying from an azure storage account to azurite

onionhammer avatar Nov 26 '24 19:11 onionhammer

This is still happening when copying from an azure storage account to azurite

@onionhammer Would you please share the Azurite debug log for the issue you meet? And the Azurite version.

blueww avatar Nov 27 '24 03:11 blueww