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

Batch update fails with internalServerError for production-style URLs #2322

Open tomachristian opened 11 months ago

tomachristian commented 11 months ago

Which service(blob, file, queue, table) does this issue concern?

The table service.

Which version of the Azurite was used?

Azurite v3.27.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

DuckerHub

What's the Node.js version?

N/A

What problem was encountered?

I am using Orleans to connect to Azurite using a production-style URL. Orleans tries to do some batch operations and Azurite fails for those with the 500 status code. Enabling debug logs surfaces the error: Couldn't extract path from URL in sub-Request.

Steps to reproduce the issue?

Use a batch operation with a production-style URL.

Have you found a mitigation/solution?

Investigating the source code of Azurite, starting from the line of code that throws that error takes us to the implementation of extractPath which does not seem to support production-style URLs, but it always assumes that the account name is/should be in the path.

Solution: Fix extractPath so that it supports production-style URLs.

EmmaZhu commented 11 months ago

I can repro the issue with code as following with Storage Blob .Net SDK:

var serviceClient = new TableServiceClient(
    new Uri("http://devstoreaccount1.blob.localhost:10002/"),
    new TableSharedKeyCredential("devstoreaccount1", "accountkey=="));

var tableClient = serviceClient.GetTableClient("tablename");
tableClient.CreateIfNotExists();

var entity = new TableEntity("partitionKey1", "rowKey1");
entity.Add("key1", 54.000);
TableTransactionAction action = new TableTransactionAction(TableTransactionActionType.Add, entity);
List<TableTransactionAction> actions = new List<TableTransactionAction>();
actions.Add(action);
tableClient.SubmitTransaction(actions);

We'll look into it.

EmmaZhu commented 11 months ago

Hi @edwin-huber , would you be able to take a look at this?

tomachristian commented 5 months ago

@EmmaZhu, @edwin-huber any news on this please?

edwin-huber commented 5 months ago

I have a huge workload at the moment, it is preventing me from spending time on Azurite, I shall try to get to this as soon as my load lets up.