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

azurite Service request failed. Status: 400 (Bad Request) #1625

Open jriggs opened 2 years ago

jriggs commented 2 years ago

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

blob

Which version of the Azurite was used?

$ azurite -v 3.18.0

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

npm

What's the Node.js version?

node -v v16.15.0

What problem was encountered?

Testing c# locally. Same code works against azure cloud instances.
Azure.Core (1.25) Azure.Storage.Blobs (12.13.0)

Steps to reproduce the issue?

BlobServiceClient blobServiceClient = new BlobServiceClient("UseDevelopmentStorage=true");
blobContainerClient = blobServiceClient.GetBlobContainerClient("container");
BlockBlobClient blobClient =  blobContainerClient.GetBlockBlobClient("path/to/file.cs");
 var query = "SELECT column1 FROM BlobStorage";
 var blobStream = (await blobClient.QueryAsync(query)).Value.Content;  

Exception

Azure.RequestFailedException: 'Service request failed. Status: 400 (Bad Request)

Headers: Server: Azurite-Blob/3.18.0 Date: Wed, 03 Aug 2022 20:47:48 GMT Connection: keep-alive Keep-Alive: REDACTED Content-Length: 0 '

note this code with the same instance of the blob client works

var file = await blobClient.DownloadContentAsync();

If possible, please provide the debug log using the -d parameter, replacing \<pathtodebuglog> with an appropriate path for your OS, or review the instructions for docker containers:

-d "<pathtodebuglog>"

2022-08-03T19:25:03.594Z 3764ee6b-26da-4ffb-ba5e-f4dc2e6c858a info: BlobStorageContextMiddleware: RequestMethod=POST RequestURL=http://127.0.0.1/devstoreaccount1/container/path/to/file.cs?comp=query RequestHeaders:{"host":"127.0.0.1:10000","x-ms-version":"2021-08-06","accept":"application/xml","x-ms-client-request-id":"9345e6b8-2863-443f-a133-ba6d82ddad33","x-ms-return-client-request-id":"true","user-agent":"azsdk-net-Storage.Blobs/12.13.0 (.NET 6.0.6; Microsoft Windows 10.0.19044)","x-ms-date":"Wed, 03 Aug 2022 19:25:03 GMT","authorization":"SharedKey devstoreaccount1:guoNasb74XYUpCc1AdN+EQU0yqWgS7Q+aFiedzc5x1Y=","content-type":"application/xml","content-length":"720"} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1 2022-08-03T19:25:03.594Z 3764ee6b-26da-4ffb-ba5e-f4dc2e6c858a info: BlobStorageContextMiddleware: Account=devstoreaccount1 Container=container Blob=path/to/file.csv 2022-08-03T19:25:03.594Z 3764ee6b-26da-4ffb-ba5e-f4dc2e6c858a verbose: DispatchMiddleware: Dispatching request... 2022-08-03T19:25:03.594Z 3764ee6b-26da-4ffb-ba5e-f4dc2e6c858a error: DispatchMiddleware: Incoming URL doesn't match any of swagger defined request patterns. 2022-08-03T19:25:03.595Z 3764ee6b-26da-4ffb-ba5e-f4dc2e6c858a error: ErrorMiddleware: Received a MiddlewareError, fill error information to HTTP response 2022-08-03T19:25:03.595Z 3764ee6b-26da-4ffb-ba5e-f4dc2e6c858a error: ErrorMiddleware: ErrorName=UnsupportedRequestError ErrorMessage=Incoming URL doesn't match any of swagger defined request patterns. ErrorHTTPStatusCode=400 ErrorHTTPStatusMessage=undefined ErrorHTTPHeaders=undefined ErrorHTTPBody=undefined ErrorStack="UnsupportedRequestError: Incoming URL doesn't match any of swagger defined request patterns.\n at Object.dispatchMiddleware [as default] (C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\dist\src\blob\generated\middleware\dispatch.middleware.js:41:30)\n at C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\dist\src\blob\generated\ExpressMiddlewareFactory.js:49:42\n at Layer.handle [as handle_request] (C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\layer.js:95:5)\n at trim_prefix (C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\index.js:328:13)\n at C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\index.js:286:9\n at Function.process_params (C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\index.js:346:12)\n at next (C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\index.js:280:10)\n at blobStorageContextMiddleware (C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\dist\src\blob\middlewares\blobStorageContext.middleware.js:75:5)\n at C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\dist\src\blob\middlewares\blobStorageContext.middleware.js:15:16\n at Layer.handle [as handle_request] (C:\Users\JRiggs\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\layer.js:95:5)" 2022-08-03T19:25:03.595Z 3764ee6b-26da-4ffb-ba5e-f4dc2e6c858a error: ErrorMiddleware: Set HTTP code: 400 2022-08-03T19:25:03.595Z 3764ee6b-26da-4ffb-ba5e-f4dc2e6c858a error: ErrorMiddleware: Set HTTP body: undefined 2022-08-03T19:25:03.595Z 3764ee6b-26da-4ffb-ba5e-f4dc2e6c858a info: EndMiddleware: End response. TotalTimeInMS=1 StatusCode=400 StatusMessage=undefined Headers={"server":"Azurite-Blob/3.18.0"}

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?

no

blueww commented 2 years ago

@jriggs

Blob Query is still not supported by Azurite, see https://github.com/Azure/Azurite#support-matrix