Skip to content

Conversation

@eehlin
Copy link
Contributor

@eehlin eehlin commented Dec 15, 2025

Background / history

Here at University of Skövde we have not been able to upgrade to versions > 4.18 of DSW since later versions are unable to communicate with our S3 storage (Qumulo based).

Errors received:
GeneralServerError "Error in S3: MErrValidation (MErrVJsonParse "Error in $: key \"Code\" not found")"
(for example when putting a document template using dsw-tdk tool.)

Solution

Now when I'm more familiar with the project(s) in DSW and also been able to get a local development environment running I've been able to probe the behavior/issue deeper and I came up with the following information that hopefully backs the solution provided in PR:

Raw HTTP-response from S3-call (gathered from within minio-hs library after some local changes):

--- S3 Response Debug Log ---
Status: 400 Bad Request
Headers: [("Content-Type","application/json"),("Content-Length","698"),("Connection","close")]
Raw Body:
{"module": "server", "error_class": "http_bad_request_error", "description": "Header 'User-Agent' repeated", "stack": ["add_header_block_invoke at protocols/http/request.c:363", "add_header at protocols/http/request.c:370", "parse_headers at protocols/http/request.c:400", "http_request_parse at protocols/http/request.c:657", "process_request_stream_headers at protocols/http/server.c:904", "http_connection_process_decoded_request at protocols/http/server.c:1014", "http_connection_process_decoded_request at protocols/http/server.c:1020", "http_connection_process_request at protocols/http/server.c:1082", "http_connection_process_stream at protocols/http/server.c:1100"], "user_visible": false}
-----------------------------

TLDR; Duplicate User-Agent headers not allowed here apparently even though the HTTP spec. is somewhat vague in this area but it explains at least why a plain 400 http status code is returned and thus the lack of "Code" element in the body expected in the S3-communication.

Request headers inspection

After setting log level to DEBUG and enabling httpClientDebug for wizard-server it is easy to shed some light on the issue:

[Info ] �[98m[I:dfc5b07b-a4e8-4a16-8e7e-fe594c0910c8] [T:a6ddaa49-3868-44b4-8367-46f8bce6bc8e] [S3          ] Put object: 'templates/hs:vr-eng:0.10.3/3510fed5-22b2-478c-b277-4cc26139b3fe'�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Retrieving 'https://<redacted>.local/forskningsdata-staginglocation'�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Request Method 'GET'�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Request Headers: '[("User-Agent","wizard-http-client"),("Host","<redacted>.local:9000"),("Authorization","<redacted>, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=<redacted>"),("X-Amz-Date","20251203T081337Z"),("x-amz-content-sha256","UNSIGNED-PAYLOAD")]'�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Request Body ''�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Retrieving 'https://<redacted>.local/forskningsdata-staginglocation'�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Request Method 'GET'�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Request Headers: '[("User-Agent","wizard-http-client"),("User-Agent","wizard-http-client"),("Host","<redacted>.local:9000"),("Authorization","<redacted>, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=<redacted>"),("X-Amz-Date","20251203T081337Z"),("x-amz-content-sha256","UNSIGNED-PAYLOAD")]'�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Request Body ''�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Retrieved Response�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Response StatusCode: 'Status {statusCode = 400, statusMessage = "Bad Request"}'�[0m
[Debug] �[98m[I:------------------------------------] [T:------------------------------------] [HTTP Client ] Response Headers: '[("Content-Type","application/json"),("Content-Length","698"),("Connection","close")]'�[0m
[Info ] �[98m[I:dfc5b07b-a4e8-4a16-8e7e-fe594c0910c8] [T:a6ddaa49-3868-44b4-8367-46f8bce6bc8e] [S3          ] MErrValidation (MErrVJsonParse "Error in $: key \"Code\" not found")�[0m
[Info ] �[98m[I:dfc5b07b-a4e8-4a16-8e7e-fe594c0910c8] [T:a6ddaa49-3868-44b4-8367-46f8bce6bc8e] [Database    ] Transaction rollback�[0m
[Warn ] �[95m[I:dfc5b07b-a4e8-4a16-8e7e-fe594c0910c8] [T:a6ddaa49-3868-44b4-8367-46f8bce6bc8e] [Database    ] GeneralServerError "Error in S3: MErrValidation (MErrVJsonParse \"Error in $: key \\\"Code\\\" not found\")"�[0m
[Error] �[91m[I:------------------------------------] [T:------------------------------------] [API         ] Error in S3: MErrValidation (MErrVJsonParse "Error in $: key \"Code\" not found")�[0m
[Error] �[91m[I:dfc5b07b-a4e8-4a16-8e7e-fe594c0910c8] [T:------------------------------------] [API         ] 500 Internal Server Error POST /wizard-api/document-template-drafts/hs:vr-eng:0.10.3/assets�[0m

TLDR; At line 8 we can see that there are duplicate User-Agent headers and that also got confirmed by my added logging inside the minio-hs library.

Fix

By ensuring that there's only one User-Agent header for the requests that passes through the HttpClientFactory we can address the issue(s) listed and I have also tested it locally and it works fine.

Note/thoughts: I wonder if there are redirects that are causing this issue, I've not been able to debug that further but it is just a possible conclusion that popped up between my ears.

Best regards,
Eddie

@vknaisl vknaisl force-pushed the develop branch 2 times, most recently from 121040f to 8401ad5 Compare December 18, 2025 07:28
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

Successfully merging this pull request may close these issues.

2 participants