Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table batch actions update-replace and update-merge do not respect If-Match etag #1233

Closed
joelverhagen opened this issue Dec 19, 2021 · 1 comment
Assignees

Comments

@joelverhagen
Copy link
Contributor

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

table

Which version of the Azurite was used?

Locally running version of #1157

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

Git clone

What's the Node.js version?

16.13.0

What problem was encountered?

Table batch action update-replace and update-merge do not seem to respect etag (If-Match) conditions.

Steps to reproduce the issue?

using Azure;
using Azure.Data.Tables;

var tableClient = new TableServiceClient("UseDevelopmentStorage=true");
var table = tableClient.GetTableClient("table0");
table.Delete();
table.Create();
table.AddEntity(new TableEntity("PK", "RK1"));
try
{
    table.SubmitTransaction(new[]
    {
        new TableTransactionAction(TableTransactionActionType.UpdateReplace, new TableEntity("PK", "RK1"), new ETag("W/\"datetime'2015-01-01T23%3A14%3A33.4980000Z'\"")),
    });
    Console.WriteLine("Should have failed.");
}
catch (TableTransactionFailedException)
{
    Console.WriteLine("Failed as expected.");
}
2021-12-19T05:10:29.378Z 	 info: Azurite Blob service is starting on 127.0.0.1:10000
2021-12-19T05:10:29.380Z 	 info: AccountDataStore:init() Refresh accounts from environment variable AZURITE_ACCOUNTS with value undefined
2021-12-19T05:10:29.380Z 	 info: AccountDataStore:init() Fallback to default emulator account devstoreaccount1.
2021-12-19T05:10:29.424Z 	 info: BlobGCManager:start() Starting BlobGCManager. Set status to Initializing.
2021-12-19T05:10:29.425Z 	 info: BlobGCManager:start() Trigger mark and sweep loop. Set status to Running.
2021-12-19T05:10:29.425Z 	 info: BlobGCManager:markSweepLoop() Start next mark and sweep.
2021-12-19T05:10:29.425Z 	 info: BlobGCManager:markSweep() Get all extents.
2021-12-19T05:10:29.427Z 	 info: BlobGCManager:start() BlobGCManager successfully started.
2021-12-19T05:10:29.440Z 	 info: BlobGCManager:markSweep() Got 16 extents.
2021-12-19T05:10:29.441Z 	 info: BlobGCManager:markSweep() Get referred extents.
2021-12-19T05:10:29.444Z 	 info: BlobGCManager:markSweep() Got referred extents, unreferenced extents count is 2.
2021-12-19T05:10:29.444Z 	 info: BlobGCManager:markSweep() Try to delete function entries() { [native code] } unreferenced extents.
2021-12-19T05:10:29.445Z 	 debug: FSExtentStore:deleteExtents() Delete extent:330ef5de-ee48-448a-8a12-76d9d0a1f2d1 location:Default path:C:\z\Git\joelverhagen\Azurite\__blobstorage__\330ef5de-ee48-448a-8a12-76d9d0a1f2d1
2021-12-19T05:10:29.449Z 	 info: Azurite Blob service successfully listens on http://127.0.0.1:10000
2021-12-19T05:10:29.450Z 	 info: Azurite Queue service is starting on 127.0.0.1:10001
2021-12-19T05:10:29.450Z 	 info: AccountDataStore:init() Refresh accounts from environment variable AZURITE_ACCOUNTS with value undefined
2021-12-19T05:10:29.451Z 	 info: AccountDataStore:init() Fallback to default emulator account devstoreaccount1.
2021-12-19T05:10:29.453Z 	 debug: FSExtentStore:deleteExtents() Delete extent:95f59724-aa87-4bd3-b2a0-dbeb989aaab9 location:Default path:C:\z\Git\joelverhagen\Azurite\__blobstorage__\95f59724-aa87-4bd3-b2a0-dbeb989aaab9
2021-12-19T05:10:29.454Z 	 info: BlobGCManager:markSweep() Deleted unreferenced 2 extents, after excluding active write extents.
2021-12-19T05:10:29.454Z 	 info: BlobGCManager:markSweepLoop() Mark and sweep finished, taken 29ms.
2021-12-19T05:10:29.454Z 	 info: BlobGCManager:markSweepLoop() Sleep for 600000ms.
2021-12-19T05:10:29.487Z 	 info: QueueGCManager:start() Starting QueueGCManager, set status to Initializing
2021-12-19T05:10:29.487Z 	 info: QueueGCManager:start() Trigger mark and sweep loop, set status to Running.
2021-12-19T05:10:29.487Z 	 info: QueueGCManager:markSweepLoop() Start new mark and sweep.
2021-12-19T05:10:29.487Z 	 info: QueueGCManger:markSweep() Get all extents.
2021-12-19T05:10:29.488Z 	 info: QueueGCManager:start() QueueGCManager successfully started.
2021-12-19T05:10:29.488Z 	 info: QueueGCManager:marksweep() Get 1 extents.
2021-12-19T05:10:29.488Z 	 info: QueueGCManager:markSweep() Get referred extents, then remove from allExtents.
2021-12-19T05:10:29.489Z 	 info: QueueGCManager:markSweep() Got referred extents, unreferenced extents count is 0.
2021-12-19T05:10:29.489Z 	 info: QueueGCManager:markSweepLoop() Mark and sweep finished, take 2ms.
2021-12-19T05:10:29.489Z 	 info: QueueGCManager:markSweepLoop() Sleep for 60000
2021-12-19T05:10:29.491Z 	 info: Azurite Queue service successfully listens on http://127.0.0.1:10001
2021-12-19T05:10:29.492Z 	 info: Azurite Table service is starting on 127.0.0.1:10002
2021-12-19T05:10:29.492Z 	 info: AccountDataStore:init() Refresh accounts from environment variable AZURITE_ACCOUNTS with value undefined
2021-12-19T05:10:29.492Z 	 info: AccountDataStore:init() Fallback to default emulator account devstoreaccount1.
2021-12-19T05:10:29.564Z 	 info: Azurite Table service successfully listens on http://127.0.0.1:10002
2021-12-19T05:10:35.188Z ade930f9-5b52-4465-917f-1d127e70db5e info: TableStorageContextMiddleware: RequestMethod=DELETE RequestURL=http://127.0.0.1/devstoreaccount1/Tables('table0') RequestHeaders:{"host":"127.0.0.1:10002","x-ms-version":"2019-02-02","accept":"application/json","x-ms-client-request-id":"f76de367-7961-4100-a21b-030471f2194d","x-ms-return-client-request-id":"true","user-agent":"azsdk-net-Data.Tables/12.3.0 (.NET 6.0.0-rtm.21522.10; Microsoft Windows 10.0.22000)","x-ms-date":"Sun, 19 Dec 2021 05:10:35 GMT","authorization":"SharedKeyLite devstoreaccount1:a9co6u56TyrX0A9FZXZoVi7h9BxZ3tMRYpN/UKBxLGk="} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1
2021-12-19T05:10:35.189Z ade930f9-5b52-4465-917f-1d127e70db5e debug: tableStorageContextMiddleware: Dispatch pattern string: /Tables('table0')
2021-12-19T05:10:35.189Z ade930f9-5b52-4465-917f-1d127e70db5e info: tableStorageContextMiddleware: Account=devstoreaccount1 tableName=table0
2021-12-19T05:10:35.190Z ade930f9-5b52-4465-917f-1d127e70db5e verbose: DispatchMiddleware: Dispatching request...
2021-12-19T05:10:35.191Z ade930f9-5b52-4465-917f-1d127e70db5e info: DispatchMiddleware: Operation=Table_Delete
2021-12-19T05:10:35.192Z ade930f9-5b52-4465-917f-1d127e70db5e verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications.
2021-12-19T05:10:35.192Z ade930f9-5b52-4465-917f-1d127e70db5e info: TableSharedKeyLiteAuthenticator:validate() Start validation against account shared key authentication.
2021-12-19T05:10:35.193Z ade930f9-5b52-4465-917f-1d127e70db5e info: TableSharedKeyLiteAuthenticator:validate() [STRING TO SIGN]:"Sun, 19 Dec 2021 05:10:35 GMT\n/devstoreaccount1/devstoreaccount1/Tables('table0')"
2021-12-19T05:10:35.194Z ade930f9-5b52-4465-917f-1d127e70db5e info: TableSharedKeyLiteAuthenticator:validate() Calculated authentication header based on key1: SharedKeyLite devstoreaccount1:a9co6u56TyrX0A9FZXZoVi7h9BxZ3tMRYpN/UKBxLGk=
2021-12-19T05:10:35.194Z ade930f9-5b52-4465-917f-1d127e70db5e info: TableSharedKeyLiteAuthenticator:validate() Signature 1 matched.
2021-12-19T05:10:35.195Z ade930f9-5b52-4465-917f-1d127e70db5e verbose: DeserializerMiddleware: Start deserializing...
2021-12-19T05:10:35.197Z ade930f9-5b52-4465-917f-1d127e70db5e info: HandlerMiddleware: DeserializedParameters={"version":"2019-02-02","options":{"requestId":"f76de367-7961-4100-a21b-030471f2194d"}}
2021-12-19T05:10:35.200Z ade930f9-5b52-4465-917f-1d127e70db5e verbose: SerializerMiddleware: Start serializing...
2021-12-19T05:10:35.202Z ade930f9-5b52-4465-917f-1d127e70db5e info: EndMiddleware: End response. TotalTimeInMS=14 StatusCode=204 StatusMessage=undefined Headers={"server":"Azurite-Table/3.15.0","content-type":"application/json;odata=minimalmetadata","x-ms-client-request-id":"f76de367-7961-4100-a21b-030471f2194d","x-ms-request-id":"ade930f9-5b52-4465-917f-1d127e70db5e","x-ms-version":"2021-02-12","date":"Sun, 19 Dec 2021 05:10:35 GMT"}
2021-12-19T05:10:35.222Z c7b896ca-8b68-4452-aa14-8325804508e3 info: TableStorageContextMiddleware: RequestMethod=POST RequestURL=http://127.0.0.1/devstoreaccount1/Tables?$format=application%2Fjson%3Bodata%3Dminimalmetadata RequestHeaders:{"host":"127.0.0.1:10002","x-ms-version":"2019-02-02","dataserviceversion":"3.0","accept":"application/json;odata=minimalmetadata","x-ms-client-request-id":"3b1b9871-9198-4df8-9d23-8a709289f041","x-ms-return-client-request-id":"true","user-agent":"azsdk-net-Data.Tables/12.3.0 (.NET 6.0.0-rtm.21522.10; Microsoft Windows 10.0.22000)","x-ms-date":"Sun, 19 Dec 2021 05:10:35 GMT","authorization":"SharedKeyLite devstoreaccount1:Rf8kePJS7J2iIKVr6ugazCvakO5UmhOOIphFEr/W5oE=","content-type":"application/json;odata=nometadata","content-length":"22"} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1
2021-12-19T05:10:35.223Z c7b896ca-8b68-4452-aa14-8325804508e3 debug: tableStorageContextMiddleware: Dispatch pattern string: /Tables
2021-12-19T05:10:35.223Z c7b896ca-8b68-4452-aa14-8325804508e3 info: tableStorageContextMiddleware: Account=devstoreaccount1 tableName=undefined
2021-12-19T05:10:35.223Z c7b896ca-8b68-4452-aa14-8325804508e3 verbose: DispatchMiddleware: Dispatching request...
2021-12-19T05:10:35.223Z c7b896ca-8b68-4452-aa14-8325804508e3 info: DispatchMiddleware: Operation=Table_Create
2021-12-19T05:10:35.223Z c7b896ca-8b68-4452-aa14-8325804508e3 verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications.
2021-12-19T05:10:35.223Z c7b896ca-8b68-4452-aa14-8325804508e3 info: TableSharedKeyLiteAuthenticator:validate() Start validation against account shared key authentication.
2021-12-19T05:10:35.224Z c7b896ca-8b68-4452-aa14-8325804508e3 info: TableSharedKeyLiteAuthenticator:validate() [STRING TO SIGN]:"Sun, 19 Dec 2021 05:10:35 GMT\n/devstoreaccount1/devstoreaccount1/Tables"
2021-12-19T05:10:35.224Z c7b896ca-8b68-4452-aa14-8325804508e3 info: TableSharedKeyLiteAuthenticator:validate() Calculated authentication header based on key1: SharedKeyLite devstoreaccount1:Rf8kePJS7J2iIKVr6ugazCvakO5UmhOOIphFEr/W5oE=
2021-12-19T05:10:35.224Z c7b896ca-8b68-4452-aa14-8325804508e3 info: TableSharedKeyLiteAuthenticator:validate() Signature 1 matched.
2021-12-19T05:10:35.225Z c7b896ca-8b68-4452-aa14-8325804508e3 verbose: DeserializerMiddleware: Start deserializing...
2021-12-19T05:10:35.226Z c7b896ca-8b68-4452-aa14-8325804508e3 debug: deserialize(): Raw request body string is (removed all empty characters) {"TableName":"table0"}
2021-12-19T05:10:35.227Z c7b896ca-8b68-4452-aa14-8325804508e3 info: HandlerMiddleware: DeserializedParameters={"options":{"queryOptions":{"format":"application/json;odata=minimalmetadata"},"requestId":"3b1b9871-9198-4df8-9d23-8a709289f041","dataServiceVersion":"3.0"},"version":"2019-02-02","tableProperties":{"tableName":"table0"},"body":"ReadableStream"}
2021-12-19T05:10:35.229Z c7b896ca-8b68-4452-aa14-8325804508e3 verbose: SerializerMiddleware: Start serializing...
2021-12-19T05:10:35.230Z c7b896ca-8b68-4452-aa14-8325804508e3 debug: Serializer: Raw response body string is {"odata.metadata":"http://127.0.0.1:10002/devstoreaccount1/$metadata#Tables/@Element","TableName":"table0"}
2021-12-19T05:10:35.230Z c7b896ca-8b68-4452-aa14-8325804508e3 info: Serializer: Start returning stream body.
2021-12-19T05:10:35.230Z c7b896ca-8b68-4452-aa14-8325804508e3 info: EndMiddleware: End response. TotalTimeInMS=8 StatusCode=201 StatusMessage=Created Headers={"server":"Azurite-Table/3.15.0","content-type":"application/json;odata=minimalmetadata","x-ms-client-request-id":"3b1b9871-9198-4df8-9d23-8a709289f041","x-ms-request-id":"c7b896ca-8b68-4452-aa14-8325804508e3","x-ms-version":"2021-02-12","date":"Sun, 19 Dec 2021 05:10:35 GMT","preference-applied":"return-content"}
2021-12-19T05:10:35.259Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 info: TableStorageContextMiddleware: RequestMethod=POST RequestURL=http://127.0.0.1/devstoreaccount1/table0?$format=application%2Fjson%3Bodata%3Dminimalmetadata RequestHeaders:{"host":"127.0.0.1:10002","x-ms-version":"2019-02-02","dataserviceversion":"3.0","prefer":"return-no-content","accept":"application/json;odata=minimalmetadata","x-ms-client-request-id":"f83f9df8-fc2d-414a-9a6c-7e24d3c792ee","x-ms-return-client-request-id":"true","user-agent":"azsdk-net-Data.Tables/12.3.0 (.NET 6.0.0-rtm.21522.10; Microsoft Windows 10.0.22000)","x-ms-date":"Sun, 19 Dec 2021 05:10:35 GMT","authorization":"SharedKeyLite devstoreaccount1:DZhmgdmIjA46Xcfvf/0n8VMlR3PEvHRXSdX56Pd/m5Q=","content-type":"application/json;odata=nometadata","content-length":"36"} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1
2021-12-19T05:10:35.260Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 debug: tableStorageContextMiddleware: Dispatch pattern string: /table0
2021-12-19T05:10:35.260Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 info: tableStorageContextMiddleware: Account=devstoreaccount1 tableName=table0
2021-12-19T05:10:35.260Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 verbose: DispatchMiddleware: Dispatching request...
2021-12-19T05:10:35.260Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 info: DispatchMiddleware: Operation=Table_InsertEntity
2021-12-19T05:10:35.260Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications.
2021-12-19T05:10:35.260Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 info: TableSharedKeyLiteAuthenticator:validate() Start validation against account shared key authentication.
2021-12-19T05:10:35.261Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 info: TableSharedKeyLiteAuthenticator:validate() [STRING TO SIGN]:"Sun, 19 Dec 2021 05:10:35 GMT\n/devstoreaccount1/devstoreaccount1/table0"
2021-12-19T05:10:35.261Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 info: TableSharedKeyLiteAuthenticator:validate() Calculated authentication header based on key1: SharedKeyLite devstoreaccount1:DZhmgdmIjA46Xcfvf/0n8VMlR3PEvHRXSdX56Pd/m5Q=
2021-12-19T05:10:35.261Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 info: TableSharedKeyLiteAuthenticator:validate() Signature 1 matched.
2021-12-19T05:10:35.261Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 verbose: DeserializerMiddleware: Start deserializing...
2021-12-19T05:10:35.262Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 debug: deserialize(): Raw request body string is (removed all empty characters) {"PartitionKey":"PK","RowKey":"RK1"}
2021-12-19T05:10:35.263Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 info: HandlerMiddleware: DeserializedParameters={"options":{"queryOptions":{"format":"application/json;odata=minimalmetadata"},"requestId":"f83f9df8-fc2d-414a-9a6c-7e24d3c792ee","dataServiceVersion":"3.0","responsePreference":"return-no-content","tableEntityProperties":{"PartitionKey":"PK","RowKey":"RK1"}},"version":"2019-02-02","body":"ReadableStream"}
2021-12-19T05:10:35.265Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 verbose: SerializerMiddleware: Start serializing...
2021-12-19T05:10:35.265Z af337c2f-c3cf-4ccf-901d-2131cd6aa6b2 info: EndMiddleware: End response. TotalTimeInMS=6 StatusCode=204 StatusMessage=undefined Headers={"server":"Azurite-Table/3.15.0","content-type":"application/json;odata=minimalmetadata","x-ms-client-request-id":"f83f9df8-fc2d-414a-9a6c-7e24d3c792ee","x-ms-request-id":"af337c2f-c3cf-4ccf-901d-2131cd6aa6b2","x-ms-version":"2021-02-12","date":"Sun, 19 Dec 2021 05:10:35 GMT","etag":"W/\"datetime'2021-12-19T05%3A10%3A35.2590000Z'\"","preference-applied":"return-no-content"}
2021-12-19T05:10:35.284Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: TableStorageContextMiddleware: RequestMethod=POST RequestURL=http://127.0.0.1/devstoreaccount1/$batch RequestHeaders:{"host":"127.0.0.1:10002","x-ms-version":"2019-02-02","dataserviceversion":"3.0","accept":"application/json","x-ms-client-request-id":"604f7fd1-e129-4990-92f6-8d49dcda71cd","x-ms-return-client-request-id":"true","user-agent":"azsdk-net-Data.Tables/12.3.0 (.NET 6.0.0-rtm.21522.10; Microsoft Windows 10.0.22000)","x-ms-date":"Sun, 19 Dec 2021 05:10:35 GMT","authorization":"SharedKeyLite devstoreaccount1:IaSBX+XRjUlsftezCFRHGZ23RlWMcprH+wvez63FyF8=","content-type":"multipart/mixed; boundary=batch_d7c18e46-5bf5-48e1-8eea-6b57e563e539","content-length":"727"} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1
2021-12-19T05:10:35.285Z e9fe128b-80ed-44dc-81b1-04edf586c200 debug: tableStorageContextMiddleware: Dispatch pattern string: /$batch
2021-12-19T05:10:35.285Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: tableStorageContextMiddleware: Account=devstoreaccount1 tableName=$batch
2021-12-19T05:10:35.285Z e9fe128b-80ed-44dc-81b1-04edf586c200 verbose: DispatchMiddleware: Dispatching request...
2021-12-19T05:10:35.286Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: DispatchMiddleware: Operation=Table_Batch
2021-12-19T05:10:35.286Z e9fe128b-80ed-44dc-81b1-04edf586c200 verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications.
2021-12-19T05:10:35.286Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: TableSharedKeyLiteAuthenticator:validate() Start validation against account shared key authentication.
2021-12-19T05:10:35.286Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: TableSharedKeyLiteAuthenticator:validate() [STRING TO SIGN]:"Sun, 19 Dec 2021 05:10:35 GMT\n/devstoreaccount1/devstoreaccount1/$batch"
2021-12-19T05:10:35.286Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: TableSharedKeyLiteAuthenticator:validate() Calculated authentication header based on key1: SharedKeyLite devstoreaccount1:IaSBX+XRjUlsftezCFRHGZ23RlWMcprH+wvez63FyF8=
2021-12-19T05:10:35.286Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: TableSharedKeyLiteAuthenticator:validate() Signature 1 matched.
2021-12-19T05:10:35.286Z e9fe128b-80ed-44dc-81b1-04edf586c200 verbose: DeserializerMiddleware: Start deserializing...
2021-12-19T05:10:35.286Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: HandlerMiddleware: DeserializedParameters={"version":"2019-02-02","options":{"requestId":"604f7fd1-e129-4990-92f6-8d49dcda71cd","dataServiceVersion":"3.0"},"multipartContentType":"multipart/mixed; boundary=batch_d7c18e46-5bf5-48e1-8eea-6b57e563e539","contentLength":727,"body":"ReadableStream"}
2021-12-19T05:10:35.288Z e9fe128b-80ed-44dc-81b1-04edf586c200 debug: TableHandler:batch() Raw request string is "--batch_d7c18e46-5bf5-48e1-8eea-6b57e563e539\r\nContent-Type: multipart/mixed; boundary=changeset_62094e31-c31d-41ab-a3f2-c2275ec7b31e\r\n\r\n--changeset_62094e31-c31d-41ab-a3f2-c2275ec7b31e\r\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nPUT http://127.0.0.1:10002/devstoreaccount1/table0(PartitionKey='PK',RowKey='RK1')?$format=application%2Fjson%3Bodata%3Dminimalmetadata HTTP/1.1\r\nHost: 127.0.0.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nIf-Match: W/\"datetime'2015-01-01T23%3A14%3A33.4980000Z'\"\r\nAccept: application/json\r\nContent-Type: application/json\r\n\r\n{\"PartitionKey\":\"PK\",\"RowKey\":\"RK1\"}\r\n--changeset_62094e31-c31d-41ab-a3f2-c2275ec7b31e--\r\n\r\n--batch_d7c18e46-5bf5-48e1-8eea-6b57e563e539--\r\n"
2021-12-19T05:10:35.292Z e9fe128b-80ed-44dc-81b1-04edf586c200 debug: TableHandler:batch() Raw response string is "--batchresponse_d7c18e46-5bf5-48e1-8eea-6b57e563e539\r\nContent-Type: multipart/mixed; boundary=changesetresponse_62094e31-c31d-41ab-a3f2-c2275ec7b31e\r\n\r\n--changesetresponse_62094e31-c31d-41ab-a3f2-c2275ec7b31e\r\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2021-12-19T05%3A10%3A35.2840000Z'\"\r\n\r\n--changesetresponse_62094e31-c31d-41ab-a3f2-c2275ec7b31e--\r\n--batchresponse_d7c18e46-5bf5-48e1-8eea-6b57e563e539--\r\n"
2021-12-19T05:10:35.293Z e9fe128b-80ed-44dc-81b1-04edf586c200 verbose: SerializerMiddleware: Start serializing...
2021-12-19T05:10:35.293Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: Serializer: Start returning stream body.
2021-12-19T05:10:35.296Z e9fe128b-80ed-44dc-81b1-04edf586c200 info: EndMiddleware: End response. TotalTimeInMS=12 StatusCode=202 StatusMessage=Accepted Headers={"server":"Azurite-Table/3.15.0","content-type":"multipart/mixed; boundary=batchresponse_d7c18e46-5bf5-48e1-8eea-6b57e563e539","x-ms-request-id":"e9fe128b-80ed-44dc-81b1-04edf586c200","x-ms-version":"2021-02-12","date":"Sun, 19 Dec 2021 05:10:35 GMT"}
2021-12-19T05:10:38.139Z 	 info: Azurite Blob service is closing...
2021-12-19T05:10:38.140Z 	 info: Azurite Queue service is closing...
2021-12-19T05:10:38.140Z 	 info: Azurite Table service is closing...
2021-12-19T05:10:38.143Z 	 info: BlobGCManager:close() Start closing BlobGCManager. Set status to Closing.
2021-12-19T05:10:38.143Z 	 info: QueueGCManager:close() Start closing QueueGCManager, set status to Closing.
2021-12-19T05:10:38.177Z 	 info: BlobGCManager:start() Mark and sweep loop is closed.
2021-12-19T05:10:38.177Z 	 info: BlobGCManager:close() BlobGCManager successfully closed. Set status to Closed.
2021-12-19T05:10:38.177Z 	 info: QueueGCManager:start() Mark and sweep loop is closed.
2021-12-19T05:10:38.177Z 	 info: QueueGCManager:close() QueueGCManager successfully closed, set status to Closed.
2021-12-19T05:10:38.178Z 	 info: Azurite Blob service successfully closed
2021-12-19T05:10:38.178Z 	 info: Azurite Queue service successfully closed
2021-12-19T05:10:38.196Z 	 info: Azurite Table service successfully closed

Please be sure to remove any PII or sensitive information before sharing!
The debug log will log raw request headers and bodies, so that we can replay these against Azurite using REST and create tests to validate resolution.

Have you found a mitigation/solution?

@joelverhagen
Copy link
Contributor Author

The fix appears to be:

diff --git a/src/table/batch/TableBatchOrchestrator.ts b/src/table/batch/TableBatchOrchestrator.ts
index 0bbbb1f..4876a65 100644
--- a/src/table/batch/TableBatchOrchestrator.ts
+++ b/src/table/batch/TableBatchOrchestrator.ts
@@ -486,13 +486,14 @@ export default class TableBatchOrchestrator {
     updatedContext.request = request;
     let partitionKey: string;
     let rowKey: string;
+    const ifmatch: string = request.getHeader("if-match") || "*";
     ({ partitionKey, rowKey } = this.extractRowAndPartitionKeys(request));
 
     response = await this.parentHandler.updateEntity(
       request.getPath(),
       partitionKey,
       rowKey,
-      request.params as BatchTableUpdateEntityOptionalParams,
+      { ifMatch: ifmatch, ...request.params } as BatchTableUpdateEntityOptionalParams,
       updatedContext,
       batchID
     );
@@ -614,13 +615,14 @@ export default class TableBatchOrchestrator {
     updatedContext.request = request;
     let partitionKey: string;
     let rowKey: string;
+    const ifmatch: string = request.getHeader("if-match") || "*";
     ({ partitionKey, rowKey } = this.extractRowAndPartitionKeys(request));
 
     response = await this.parentHandler.mergeEntity(
       request.getPath(),
       partitionKey,
       rowKey,
-      request.params as BatchTableMergeEntityOptionalParams,
+      { ifMatch: ifmatch, ...request.params } as BatchTableMergeEntityOptionalParams,
       updatedContext,
       batchID
     );

@edwin-huber edwin-huber self-assigned this Jan 18, 2022
edwin-huber added a commit to edwin-huber/Azurite that referenced this issue Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants