-
Notifications
You must be signed in to change notification settings - Fork 873
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
Credentials reloading is not working in the recent versions (2.20.x) #4268
Comments
@dave-fn FYI |
@munendrasn can you provide a sample code we can use to reproduce? |
Creating AWS Clients, without specifying any explicit credentials provider return AthenaClient.builder().build() Steps to reproduce: K8s (Preferred way to reproduce, mimics the normal usage)
Mac
This flows works with 2.19.33 but fails with recent version of aws java sdk for credentials reloading @debora-ito Kindly, let me know if any additional info is required. As there is no specific logic in creating the client, provided the sample one-liner code for AthenaClient creation |
@debora-ito any update on this? We are facing the same issue with sdk 2.20.81 |
Same thing for us on |
Hello, I prepared sample that reproduces this issue: SDK version: Create two files [default]
aws_access_key_id=test_aaaaaaaa
aws_secret_access_key=test_aaaaaaaa
aws_session_token=test_aaaaaaaa and [default]
aws_access_key_id=test_bbbbbbbb
aws_secret_access_key=test_bbbbbbbb
aws_session_token=test_bbbbbbbb Then run following java program with public class MyClass {
public static void main(String[] args) {
DefaultCredentialsProvider credentialsWithProfileFile = DefaultCredentialsProvider.builder()
.profileFile(ProfileFileSupplier.defaultSupplier())
.build();
DefaultCredentialsProvider credentialsDefault = DefaultCredentialsProvider.create();
Path credentialsFilePath = FileSystems.getDefault().getPath(System.getenv("AWS_SHARED_CREDENTIALS_FILE"));
List<Path> testCredentials = new ArrayList<>();
testCredentials.add(credentialsFilePath.resolveSibling(credentialsFilePath.getFileName() + ".test_a"));
testCredentials.add(credentialsFilePath.resolveSibling(credentialsFilePath.getFileName() + ".test_b"));
int fileIndex = 0;
while(true) {
Path currentPath = testCredentials.get(fileIndex++ % testCredentials.size());
System.out.println("Writing credentials file from " + currentPath);
try {
Files.copy(currentPath, credentialsFilePath, REPLACE_EXISTING);
} catch (IOException e) {
System.out.println("ERROR " + e.getMessage());
}
tryCredentials(credentialsDefault, "Default ");
tryCredentials(credentialsWithProfileFile, "With ProfileFileSupplier");
System.out.println("---");
try {
Thread.sleep(1000);
} catch(InterruptedException e) {
System.exit(0);
}
}
}
private static void tryCredentials(AwsCredentialsProvider provider, String name) {
String accessKeyId = "";
try {
var credentials = provider.resolveCredentials();
accessKeyId = credentials.accessKeyId();
} catch(Exception e) {
accessKeyId = "ERROR " + e.getMessage();
}
System.out.format("Access Key ID (%s): %s*****\n", name, accessKeyId.substring(0, accessKeyId.length() - 5));
}
} The output is
As you can see the default builder for the |
Describe the bug
Support to reload credentials was added in 2.19.x (maybe in 2.19.33), related to PR - #3712
Expected Behavior
Expected to reload the credentials when there is a change in credentials
Current Behavior
When recently upgraded to 2.20.x, encountering the token expired error, Same error for multiple AWS Services. Tried with 2.20.112
Reproduction Steps
Upgrade to latest version of aws sdk, and update the credentials, it should pick it but not working
Possible Solution
Maybe this is occurring post this change - 8e55ccc
ie, from 2.20.54
Here, should it be 8e55ccc#diff-20afd65c6f0a6de7d5d0669cbd441b1c14afcdf694c379387f57e8399f93c8fcR269
ProfileSupplier.defaultSupplier()
instead offixedSupplier
?Additional Information/Context
No response
AWS Java SDK version used
2.20.112
JDK version used
11
Operating System and version
Mac OS - 13.5
The text was updated successfully, but these errors were encountered: