Azure / Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
MIT License
1.8k stars 320 forks source link

The error message of error "LeaseNotPresentWithBlobOperation" in azurite is inconsistent with the one in azure cloud #635

Open zzhxiaofeng opened 3 years ago

zzhxiaofeng commented 3 years ago

Error Description: The error message of error "LeaseNotPresentWithBlobOperation" in azurite is inconsistent with the one in azure cloud. In azure, the error is shown as following: Screenshot 2020-11-19 154519 In azurite, the error is shown as following: Screenshot 2020-11-19 154619

To Reproduce Please run the demo code as following:

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 blockBlobClient = await containerClient.getBlockBlobClient("<blob-name>");
  try{
    await blockBlobClient.commitBlockList(new Array(),{conditions:{leaseId:<your-lease-Id>}});
  }catch(err){
    console.log(err);
    assert.ok((err as any).response.parsedBody.message.includes("There is currently no lease on the blob"));
  }
}

main();

Error Track The reason maybe is that the error message of error "LeaseNotPresentWithBlobOperation" which is defined in Azurite is different from the one in Azure. The error "LeaseNotPresentWithBlobOperation" defined in Azurite is shown as following: https://github.com/Azure/Azurite/blob/master/src/blob/errors/StorageErrorFactory.ts#L390 Screenshot 2020-11-18 173049

Expected Behavior The error message of error "LeaseNotPresentWithBlobOperation" in azurite is consistent with the one in azure cloud.

@jongio for notification.

blueww commented 3 years ago

@zzhxiaofeng Thanks for raising the issue! We will evaluate it.

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

v-xuto commented 3 years ago

azsdk-azurite

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.