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

Put Block List returns 500 Internal Server Error #1955

Open
cloudtest-anon opened this issue May 5, 2023 · 2 comments
Open

Put Block List returns 500 Internal Server Error #1955

cloudtest-anon opened this issue May 5, 2023 · 2 comments
Assignees
Labels
blob-storage question Further information is requested

Comments

@cloudtest-anon
Copy link

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

Azure Blob

Which version of the Azurite was used?

3.21.0

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

npm

What's the Node.js version?

14.18.1

What problem was encountered?

When performing a Put Block List operation, an unexpected 500 Internal Server Error was encountered. When investigated, it was found that the body of this request must be in XML format. Passing a body other than XML (e.g., JSON) leads to a 500. This was verified by replacing the JSON body with valid XML. The expected behavior should return a response "400 -- Bad Request" for the invalid body.

Request:

PUT /devstoreaccount1/container78/blob125?comp=blocklist HTTP/1.1\r\nAccept: application/json\r\nHost: 127.0.0.1:10000\r\nx-ms-version: 2021-12-02\r\nContent-Type: application/json\r\nAUTH_TOKEN\r\n\r\n{"BlockList": {"Committed": "first-base64-encoded-block-id","Uncommitted": "second-base64-encoded-block-id","Latest": "third-base64-encoded-block-id"}}

Response:

HTTP/1.1 500 Internal Server Error\r\nServer: Azurite-Blob/3.21.0\r\nDate: Tue, 07 Feb 2023 21:07:27 GMT\r\nConnection: keep-alive\r\nKeep-Alive: timeout=5\r\nContent-Length: 0\r\n\r\n

Steps to reproduce the issue?

The following REST calls should hit this case:

PUT /devstoreaccount1/container78?restype=container HTTP/1.1\r\nAccept: application/json\r\nHost: 127.0.0.1:10000\r\nx-ms-version: 2021-12-02\r\nAUTH_TOKEN\r\n\r\n
PUT /devstoreaccount1/container78/blob125?comp=blocklist HTTP/1.1\r\nAccept: application/json\r\nHost: 127.0.0.1:10000\r\nx-ms-version: 2021-12-02\r\nContent-Type: application/json\r\nAUTH_TOKEN\r\n\r\n{"BlockList": {"Committed": "first-base64-encoded-block-id","Uncommitted": "second-base64-encoded-block-id","Latest": "third-base64-encoded-block-id"}}

Debug log

2023-05-05T05:32:12.363Z 283af665-d775-46e0-96fa-80cdfb2a69cd info: DispatchMiddleware: Operation=BlockBlob_CommitBlockList
2023-05-05T05:32:12.363Z 283af665-d775-46e0-96fa-80cdfb2a69cd verbose: DeserializerMiddleware: Start deserializing...
2023-05-05T05:32:12.363Z 283af665-d775-46e0-96fa-80cdfb2a69cd debug: deserialize(): Raw request body string is (removed all empty characters) {"BlockList":{"Committed":"first-base64-encoded-block-id","Uncommitted":"second-base64-encoded-block-id","Latest":"third-base64-encoded-block-id"}}
2023-05-05T05:32:12.363Z 283af665-d775-46e0-96fa-80cdfb2a69cd info: HandlerMiddleware: DeserializedParameters={"options":{"metadata":{},"blobHTTPHeaders":{},"leaseAccessConditions":{},"cpkInfo":{},"modifiedAccessConditions":{}},"comp":"blocklist","version":"2021-12-02","blocks":{"committed":[],"uncommitted":[],"latest":[],"BlockList":{"Committed":"first-base64-encoded-block-id","Uncommitted":"second-base64-encoded-block-id","Latest":"third-base64-encoded-block-id"}},"body":"ReadableStream"}
2023-05-05T05:32:12.363Z 283af665-d775-46e0-96fa-80cdfb2a69cd error: ErrorMiddleware: Received an error, fill error information to HTTP response
2023-05-05T05:32:12.364Z 283af665-d775-46e0-96fa-80cdfb2a69cd error: ErrorMiddleware: ErrorName=Error ErrorMessage=Non-whitespace before first tag.
Line: 0
Column: 1
Char: { ErrorStack="Error: Non-whitespace before first tag.\nLine: 0\nColumn: 1\nChar: {\n    at error (/usr/local/lib/node_modules/azurite/node_modules/sax/lib/sax.js:651:10)\n    at strictFail (/usr/local/lib/node_modules/azurite/node_modules/sax/lib/sax.js:677:7)\n    at beginWhiteSpace (/usr/local/lib/node_modules/azurite/node_modules/sax/lib/sax.js:951:7)\n    at SAXParser.write (/usr/local/lib/node_modules/azurite/node_modules/sax/lib/sax.js:1006:11)\n    at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/azurite/node_modules/xml2js/lib/parser.js:323:31)\n    at Parser.parseString (/usr/local/lib/node_modules/azurite/node_modules/xml2js/lib/parser.js:5:59)\n    at /usr/local/lib/node_modules/azurite/dist/src/blob/generated/utils/xml.js:28:19\n    at new Promise (<anonymous>)\n    at Object.parseXML (/usr/local/lib/node_modules/azurite/dist/src/blob/generated/utils/xml.js:27:12)\n    at BlockBlobHandler.commitBlockList (/usr/local/lib/node_modules/azurite/dist/src/blob/handlers/BlockBlobHandler.js:189:36)"
2023-05-05T05:32:12.364Z 283af665-d775-46e0-96fa-80cdfb2a69cd error: ErrorMiddleware: Set HTTP code: 500
2023-05-05T05:32:12.364Z 283af665-d775-46e0-96fa-80cdfb2a69cd info: EndMiddleware: End response. TotalTimeInMS=2 StatusCode=500 StatusMessage=undefined Headers={"server":"Azurite-Blob/3.21.0"}
@blueww
Copy link
Member

blueww commented May 5, 2023

@anna-mazhar
Could you please give the whole debug log of the failed request?
We would need it for the investigation.

@blueww blueww added blob-storage question Further information is requested labels May 5, 2023
@cloudtest-anon
Copy link
Author

Sure.

debug.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blob-storage question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants