-
Notifications
You must be signed in to change notification settings - Fork 492
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
Minio Cannot list Objects in a bucket using JAVA SDK Client, getting error Non-XML response from server. Response code: 403 #1631
Comments
Hi. I have the same "Non-XML response from server" error. We use our own S3 implementation, the problem is in the content-type header. Our server returns https://github.com/minio/minio-java/blob/master/api/src/main/java/io/minio/S3Base.java#L693 String contentType = response.headers().get("content-type");
if (!method.equals(Method.HEAD)
&& (contentType == null
|| !Arrays.asList(contentType.split(";")).contains("application/xml"))) {
if (response.code() == 304 && response.body().contentLength() == 0) {
completableFuture.completeExceptionally(
new ServerException( BTW https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#RESTErrorResponses says:
|
@lexakimov do you know if there is any stable version where this still works? |
As per the S3 specification, any failed call should return
|
@harshit149 no, I've made a workaround for now by handling the InvalidResponseException. The developers of our S3 storage have confirmed that the error is on their side (wrong header), not in client. |
@balamurugana it returns valid xml, but header Content-Type is wrong (client expects application/xml )
|
Thank you for detailed response and findings. |
I have issue similar to @harshit149 the actual cause is how the URL is being constructed. URL Constructed by MinIO Client: https://abc.com/myBucket?list-type=2&prefix=t&max-keys=1000&encoding-type=url&delimiter=/ @balamurugana this URL is invalid for me even I am not able to make call via Postman, but after a small tweek I am able to make call on same url via postman. tweeked URL: https://abc.com/myBucket/?list-type=2&prefix=t&max-keys=1000&encoding-type=url&delimiter= For better understanding what I did is added slash after bucket name like this "myBucket/". I am not sure in the MinIO URL if you observe the slash is being added but at the very last just after delimiter like this "delimiter=/" I have created client and the code to access files inside bucket like below
|
@harshit149 in my case it was necessary to catch the "no such key found" before fix i did it this way: e is ErrorResponseException && e.errorResponse().code().equals("NoSuchKey") as temporary workaround i added another condition: e is InvalidResponseException && (e.message?.contains("NoSuchKey") == true || e.httpTrace().contains("NoSuchKey") |
@lexakimov It is server side problem. What object storage service are you using? |
@gyanicit This is server side issue. There is no need to add |
@balamurugana in my case we are using minio object storage service, how can we fix this? |
Share your MinIO server detail |
I am trying to access objects of a bucket via Minio JAVA SdK Client and I am getting following error
io.minio.errors.InvalidResponseException: Non-XML response from server. Response code: 403, Content-Type: text/xml; charset=utf-8, body:
What after debugging I am suspecting is URL is not formed correctly by SDK and there is forward slash miss after bucket name in URL.
The text was updated successfully, but these errors were encountered: