A NoSuchBucketException is being thrown when trying to copy files into a Wasabi bucket that already exists

I have a Spring Boot application that manages files stored in a Wasabi bucket. I have a requirement to copy files from one location in the bucket to another, so I am using an S3TransferManager to handle this operation. However, whenever I try to copy a file, the SDK reports that the bucket doesn’t exist, even though I have visually verified its presence via the Wasabi console and also by checking for typos in the bucket name in my code.

Here is the configuration class that creates the beans I use to manage S3 operations

@Configuration
public class Config {
@Bean(name = "wasabiCredentialsProvider")
public AwsCredentialsProvider wasabiCredentialProvider(@Value("${the.accessKey}") String accessKey,
                                                     @Value("${the.secretKey}") String secretKey) {
    return StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey));
}



@Bean(name = "wasabiS3Async")
public S3AsyncClient wasabiS3Async(@Qualifier("wasabiCredentialsProvider") AwsCredentialsProvider awsCredentialsProvider,
                                   @Value("${the.region}") String region,
                                   @Value("${the.endpoint}") String endpoint) throws URISyntaxException {
    SdkAsyncHttpClient nettyHttpClient = NettyNioAsyncHttpClient.builder()
            .connectionAcquisitionTimeout(Duration.ofHours(3))
            .connectionTimeout(Duration.ofHours(3))
            .readTimeout(Duration.ofHours(3))
            .writeTimeout(Duration.ofHours(3))
            .maxConcurrency(100)
            .build();
    S3AsyncClientBuilder s3AsyncClientBuilder = S3AsyncClient.builder()
            .credentialsProvider(awsCredentialsProvider)
            .region(Region.of(region))
            .httpClient(nettyHttpClient);
    if (endpoint.contains("localhost")) {
        s3AsyncClientBuilder.endpointOverride(new URI(endpoint))
                .serviceConfiguration(S3Configuration.builder().pathStyleAccessEnabled(true).build());
    }
    return s3AsyncClientBuilder.build();
}

@Bean(name = "wasabiS3TransferManager")
public S3TransferManager wasabiS3TransferManager(final S3AsyncClient wasabiS3Async) {
    return S3TransferManager.builder()
            .s3Client(wasabiS3Async)
            .build();
}
}

Now here is the method where the problem occurs

private final S3TransferManager wasabiS3TransferManager;


public void copyFile(final String sourceFolder, final String targetFolder, final String sourceFileId, final String bucketName, final String targetFileId) {
    
    S3TransferManager s3TransferManager = wasabiS3TransferManager;
    String sourceBucketPath = String.format("%s/%s", sourceFolder, sourceFileId);
    String targetBucketPath = String.format("%s/%s", targetFolder, targetFileId);


    try {
        CopyObjectRequest copyObjectRequest = CopyObjectRequest.builder()
                .sourceBucket(bucketName)
                .sourceKey(sourceBucketPath)
                .destinationBucket(bucketName)
                .destinationKey(targetBucketPath)
                .build();
        CopyRequest copyRequest = CopyRequest.builder()
                .copyObjectRequest(copyObjectRequest)
                .build();
        Copy copy = s3TransferManager.copy(copyRequest);
        copy.completionFuture().join();
    } catch (Exception exception) {
        log.error("There was an error", exception.getMessage());
//Exception handling happens here 
    }
    
}

This is the exception message

software.amazon.awssdk.services.s3.model.NoSuchBucketException: The specified bucket does not exist (Service: S3, Status Code: 404, Request ID: <blah>, 
Extended Request ID:<blah>)

I had thought that this might be a problem with the region that’s set on the S3AsyncClient bean but I’m injecting the correct value.

Any help is appreciated

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật