-
Notifications
You must be signed in to change notification settings - Fork 869
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
S3CrtAsyncClient does not work with AnonymousCredentialsProvider #5810
Comments
@cgoina can you share the full stacktrace of the NPE? |
This stack I got with jdk 23 but it fails at the same spot with jdk 8 as I specified in the ticket
|
The current implementation that checks for an AnonympusCredentialsProvider instance is incomplete because.
|
I can't reproduce the NullPointerException. In theory, you would not need to add the null checks in In you code example a ListObjectsV2Publisher listObjectsV2Publisher =
s3Adapter.getAsyncS3Client().listObjectsV2Paginator(listRequest); |
Another possible cause is you're using an old version of |
I am using 'software.amazon.awssdk.crt:aws-crt:0.33.9' but the example I provided will not fail because it uses AnonymousCredentials provider and the implementation already checks that. As I mentioned use a credentials provider defined as a lambda or a chain provider that has the anonymousprovider first in the chain:
If you put the AnonymousCredentialsProvider last in the chain it will work. If you put it first it doesn't. In some sense this is a regresssion because the async client created by S3AsyncClient.builder() works with the above chain - the one created by crtBuilder doesn't |
Okay, I see the issue now: when the AnonymousCredentialsProvider is the first in the credential provider chain, the default s3AsyncClient will pick and use it, while the S3CrtAsyncClient will throw the error. We'll look into this. In my local tests, putting the AnonymousCredentialsProvider as last throws the error too if none of the previous providers was picked, so I would double-check in your tests if another credential provider is being picked up before the chain reaches the AnonymousCredentialsProvider. And as a side note, since having AnonymousCredentialsProvider as first works for s3AsyncClient, this means that the other providers in the chain will never be used. Just want to be sure this is the behavior you expected to see. |
Describe the bug
When the S3CrtAsyncClientBuilder is configured only with AnonymousCredentialsProvider it generates a NullPointerException.
Regression Issue
Expected Behavior
CrtAsyncClient should work with an open bucket when only AnonymousCredentials are set
Current Behavior
The problem is in the CrtCredentialsProviderAdapter
Reproduction Steps
create a crt async client then run a list or getobject request against an open bucket that does not require any credentials for reading.
{
S3CrtAsyncClientBuilder asyncS3ClientBuilder = S3AsyncClient.crtBuilder();
asyncS3ClientBuilder.credentialsProvider(AnonymousCredentialsProvider.create());
S3AsyncClient asyncClient = asyncS3ClientBuilder.build();
}
Possible Solution
Change the internal.CrtCredentialsProvider's constructor
Additional Information/Context
No response
AWS Java SDK version used
2.30.1
JDK version used
"1.8.0_422" - OpenJDK 64-Bit Server VM (Zulu 8.80.0.17-CA-macos-aarch64) (build 25.422-b05, mixed mode)
Operating System and version
Mac OS Sequoia 15.2
The text was updated successfully, but these errors were encountered: