Azure / Azurite

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

The error returned in Azurite is inconsistent with the one in Azure when use unauthorized queueClient to perform operation #660

Open zzhxiaofeng opened 3 years ago

zzhxiaofeng commented 3 years ago

Error Description: The error returned in Azurite is inconsistent with the one in Azure when use unauthorized queueClient to perform operation. In Azure, the error is shown as following: Screenshot 2020-12-15 141905 In Azurite, the error is shown as following: Screenshot 2020-12-15 113027 Note: Azurite doesn't define error ResourceNotFound.

To Reproduce The demo code is shown as following:

import { QueueClient,StorageSharedKeyCredential, QueueServiceClient } from "@azure/storage-queue"
import * as assert from "assert"

async function main(){
  const queueServiceClient = new QueueServiceClient("<queue-endpoint>",new StorageSharedKeyCredential("<account-name>","<account-key>"));
  const queueClient = queueServiceClient.getQueueClient("<queue-name>");
  const unauthorizedQueueClient = new QueueClient(queueClient.url);
  await unauthorizedQueueClient.create();
}

main().catch((err)=>{
  assert.ok((err as any).response.parsedBody.Code === "ResourceNotFound");
});

Expected Behavior The error returned in Azurite is consistent with the one in Azure when use unauthorized queueClient to perform operation.

@jongio for notification.

XiaoningLiu commented 3 years ago

Hi @zzhxiaofeng Thanks for this. We should update Queue to use 404 instead of 403.

FYI. Even for Azure Storage cloud. The blob service error code may diff between 404 or 403 for different storage account types. For Queue/Table, only 404.

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.