Skip to content

Commit a681e27

Browse files
committed
Add more logs
1 parent 08ff83a commit a681e27

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/main/java/com/uid2/shared/cloud/CloudStorageS3.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,23 @@ public CloudStorageS3(String region, String bucket, String s3Endpoint) {
7979
// After a lot of experimentation and help of Abu Abraham and Isaac Wilson the only working solution we've
8080
// found was to explicitly extract env vars populated by the service account from the role and to
8181
// manually set it on the credentials provider.
82+
String roleArn = System.getenv("AWS_ROLE_ARN");
83+
String webIdentityTokenFile = System.getenv("AWS_WEB_IDENTITY_TOKEN_FILE");
84+
LOGGER.info("AWS web identity env vars: AWS_ROLE_ARN set={}, AWS_WEB_IDENTITY_TOKEN_FILE set={}",
85+
roleArn != null && !roleArn.isBlank(),
86+
webIdentityTokenFile != null && !webIdentityTokenFile.isBlank());
87+
if (webIdentityTokenFile != null && !webIdentityTokenFile.isBlank()) {
88+
var tokenPath = Paths.get(webIdentityTokenFile);
89+
LOGGER.info("AWS web identity token path exists={}, readable={}",
90+
tokenPath.toFile().exists(),
91+
tokenPath.toFile().canRead());
92+
}
93+
if (roleArn == null || roleArn.isBlank() || webIdentityTokenFile == null || webIdentityTokenFile.isBlank()) {
94+
LOGGER.error("Missing AWS web identity env vars");
95+
}
8296
WebIdentityTokenFileCredentialsProvider credentialsProvider = WebIdentityTokenFileCredentialsProvider.builder()
83-
.roleArn(System.getenv("AWS_ROLE_ARN"))
84-
.webIdentityTokenFile(Paths.get(System.getenv("AWS_WEB_IDENTITY_TOKEN_FILE")))
97+
.roleArn(roleArn)
98+
.webIdentityTokenFile(Paths.get(webIdentityTokenFile))
8599
.build();
86100

87101
if (s3Endpoint.isEmpty()) {

0 commit comments

Comments
 (0)