-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
auth v2 not available anymore (which means - AWS Java SDK V2 cannot connect) #19720
Comments
This image is not supported, can you test using minio/minio:latest image and minio/minio:RELEASE.2023-05-04T21-44-30Z ? |
Share |
Which version of the AWS SDK for Java did you use? I wrote a small test that uses software.amazon.awssdk v2.25.49 (latest version at this time) and it works fine: package java2;
import java.io.File;
import java.net.URI;
import software.amazon.awssdk.auth.credentials.*;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.*;
public class App {
public static void main(String[] args) {
S3Client client = S3Client.builder()
.endpointOverride(URI.create("http://localhost:9000/"))
.forcePathStyle(true) // <-- THIS IS IMPORTANT
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.builder()
.accessKeyId("minioadmin")
.secretAccessKey("minioadmin")
.build()
)
)
.region(Region.US_EAST_1)
.build();
ListBucketsResponse resp = client.listBuckets();
for (Bucket bucket : resp.buckets()) {
System.out.println(bucket.name());
}
PutObjectRequest putRequest = PutObjectRequest.builder()
.bucket("test")
.key("my-test")
.build();
PutObjectResponse putResponse = client.putObject(putRequest, RequestBody.fromFile(new File("test-data")));
System.out.println(putResponse.eTag());
}
} It properly lists and prints all buckets (also tried it with the Bitnami image). It also uploaded the file without any issues. |
Did you include |
Hey thank you for your answer cheers! ps. maybe a bit more context: the error was even more misleading, because I could list objects with no results (as in - the existing objects were not returned, but there was no error - simply 0 objects returned). |
The problem is your DNS somehow resolved for the bucket DNS, so there is no way for the server to return an error in such a situation since it will look like a valid call. However, the reply would be ListBuckets(), not ListObjects(). The client is also silently ignoring this return, which is also a client bug. We document our SDKs more clearly and updated, documenting AWS SDKs would take time we only do it as a courtesy for our users. It is not expected to be complete at any given time. |
I also updated the StackOverflow answer to provide some more context. If the DNS name cannot be resolved, then the error message is correct (it reports that the hostname cannot be resolved). |
NOTE
If this case is urgent, please subscribe to Subnet so that our 24/7 support team may help you faster.
Expected Behavior
Ability to set auth to v2 via some configuration property.
The docs state that:
Current Behavior
Only v4 works. Or at least multiple different SO topics point to the fact that MinIO dosn't accept auth v2 and that's why I'm getting those errors:
And yes, that bucket is valid, because the MinIO JAVA client uses literally the same string as a bucket name and it works
Possible Solution
Bring back the v2 support
Steps to Reproduce (for bugs)
Context
This guy already described this:
https://stackoverflow.com/questions/78444784/aws-java-sdk-2-putobject-minio-the-authorization-mechanism-you-have-provide
My question is: Is there any working example of a minio server working with a new version of AWS Java SDK (V2)?
There seems to be a problem with the V2 SDK using V2 auth by default and I didn't find any way to change that behavior
I'd be happy with either:
changing the client to work with auth v4
changing the server to work with auth v2
Regression
Your Environment
The text was updated successfully, but these errors were encountered: