Open kesselb opened 1 year ago
@kesselb
Would you please share the Azurite debug log for this issue? We need it to continue the investigation.
You can collect debug log with --debug parameter.
And as you are on Docker, you also need map the debug log folder to a local folder, like :
docker run -p 10000:10000 -p 10001:10001 -v C:\workspace:/workspace mcr.microsoft.com/azure-storage/azurite azurite -l /workspace -d /workspace/debug.log --blobHost 0.0.0.0 --queueHost 0.0.0.0
,and get debug log in local folder C:\workspace
Hi @blueww and thanks for your quick reply.
Here is the debug log:
2023-07-10T10:40:03.683Z 6e4fae51-9110-4187-bbc7-e7092b284a83 info: BlobStorageContextMiddleware: RequestMethod=PUT RequestURL=http://azurite/devstoreaccount1/nextcloud26/urn%3Aoid%3A83 RequestHeaders:{"host":"azurite:10000","transfer-encoding":"chunked","expect":"100-Continue","x-ms-blob-content-type":"image/jpeg","content-type":"application/x-www-form-urlencoded","x-ms-blob-type":"BlockBlob","x-ms-version":"2017-11-09","user-agent":"Azure-Storage/1.5.4-1.5.2 (PHP 8.1.18)/Linux","date":"Mon, 10 Jul 2023 10:40:03 GMT","x-ms-client-request-id":"64abe003a622b","authorization":"SharedKey devstoreaccount1:rarenqVm5FTbCZWQpldffOrhQan6ykcoEytCt0fhtEM="} ClientIP=172.19.0.4 Protocol=http HTTPVersion=1.1
172.19.0.4 - - [10/Jul/2023:10:40:03 +0000] "PUT /devstoreaccount1/nextcloud26/urn%3Aoid%3A83 HTTP/1.1" 400 -
2023-07-10T10:40:03.683Z 6e4fae51-9110-4187-bbc7-e7092b284a83 info: BlobStorageContextMiddleware: Account=devstoreaccount1 Container=nextcloud26 Blob=urn:oid:83
2023-07-10T10:40:03.683Z 6e4fae51-9110-4187-bbc7-e7092b284a83 verbose: DispatchMiddleware: Dispatching request...
2023-07-10T10:40:03.684Z 6e4fae51-9110-4187-bbc7-e7092b284a83 error: DispatchMiddleware: Incoming URL doesn't match any of swagger defined request patterns.
2023-07-10T10:40:03.684Z 6e4fae51-9110-4187-bbc7-e7092b284a83 error: ErrorMiddleware: Received a MiddlewareError, fill error information to HTTP response
2023-07-10T10:40:03.684Z 6e4fae51-9110-4187-bbc7-e7092b284a83 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 dispatchMiddleware (/opt/azurite/dist/src/blob/generated/middleware/dispatch.middleware.js:41:30)\n at /opt/azurite/dist/src/blob/generated/ExpressMiddlewareFactory.js:50:47\n at Layer.handle [as handle_request] (/opt/azurite/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/opt/azurite/node_modules/express/lib/router/index.js:328:13)\n at /opt/azurite/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/opt/azurite/node_modules/express/lib/router/index.js:346:12)\n at next (/opt/azurite/node_modules/express/lib/router/index.js:280:10)\n at blobStorageContextMiddleware (/opt/azurite/dist/src/blob/middlewares/blobStorageContext.middleware.js:133:5)\n at /opt/azurite/dist/src/blob/middlewares/blobStorageContext.middleware.js:15:16\n at Layer.handle [as handle_request] (/opt/azurite/node_modules/express/lib/router/layer.js:95:5)"
2023-07-10T10:40:03.684Z 6e4fae51-9110-4187-bbc7-e7092b284a83 error: ErrorMiddleware: Set HTTP code: 400
2023-07-10T10:40:03.684Z 6e4fae51-9110-4187-bbc7-e7092b284a83 error: ErrorMiddleware: Set HTTP body: undefined
2023-07-10T10:40:03.684Z 6e4fae51-9110-4187-bbc7-e7092b284a83 info: EndMiddleware: End response. TotalTimeInMS=1 StatusCode=400 StatusMessage=undefined Headers={"server":"Azurite-Blob/3.24.0"}
@kesselb
Azurite currently recognize a request type from the request URI and headers. For this request, it missed a request header "Content-Length", so Azurite can't recognize which request type it is, then can't suggest which header it missed. For request can't recognize type, Azurite will return 400.
This is a limitation of Azurite framework, the fix is not easy and will has high regression risk. Since this is on a negative scenario, and we have many other new features to implementation, we might won't take this as priority recently. And will keep this issue open to track it. Feel free to contact us if you have any concern.
Thanks for the update, works for me :+1:
Which service(blob, file, queue, table) does this issue concern?
blob
Which version of the Azurite was used?
0bf58610baaf
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
DockerHub
What's the Node.js version?
The one you bundled with the docker image ;)
What problem was encountered?
The error message for a missing content-length header is different from azure.
411 is documented here: https://learn.microsoft.com/en-us/rest/api/storageservices/put-block
Steps to reproduce the issue?
Send a put block request to azurite blob and omit the content-lenght header. => Response with status code 400 / Bad Request
Send a put block request to azure blob and omit the content-lenght header. => Response with status code 411 / Content-Length HTTP header is missing.
Have you found a mitigation/solution?
Send a content-length header ;)