Skip to content
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

Vanity URLs with AWS result in bucket NOT_FOUND on #2411 #2412

Merged
merged 5 commits into from
May 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public S3Provider(String source) throws FHIRException {

String cosLocation = adapter.getStorageProviderLocation(source);
String cosEndpointUrl = adapter.getStorageProviderEndpointInternal(source);
String bucketName = adapter.getStorageProviderBucketName(source);
bucketName = adapter.getStorageProviderBucketName(source);

boolean iam = adapter.isStorageProviderAuthTypeIam(source);
isExportPublic = adapter.isStorageProviderExportPublic(source);
Expand Down Expand Up @@ -171,10 +171,16 @@ private static AmazonS3 getClient(boolean iam, String cosApiKeyProperty, String
* @return
prb112 marked this conversation as resolved.
Show resolved Hide resolved
*/
public boolean exists() {
prb112 marked this conversation as resolved.
Show resolved Hide resolved
boolean ex = client != null && client.doesBucketExistV2(bucketName);
if (ex == false) {
boolean ex = client != null;

// We only want to log a warning here, and assume it's true if the client exists
prb112 marked this conversation as resolved.
Show resolved Hide resolved
// in certain circumstances, a direct url to the bucket can be used. https://mybucketdemo123.s3.us.east-2.amazonaws.com
prb112 marked this conversation as resolved.
Show resolved Hide resolved
// versus an API enabled url e.g. https://s3.us.east-2.amazonaws.com
// These end up with TWO different responses, the former is false, and the latter is true.
if (!client.doesBucketExistV2(bucketName)) {
prb112 marked this conversation as resolved.
Show resolved Hide resolved
logger.warning("Bucket '" + bucketName + "' not found! Client [" + (client != null) + "]");
}

return ex;
}

Expand Down