Skip to content

S3AsyncClient with multi region access point #6297

@croudet38

Description

@croudet38

Describe the bug

sdk: 2.32.7
jdk: 21

Hello,
I am trying to use the S3Async client with mrap, but I got an error on authentication:

j.l.UnsupportedOperationException: null\n\tat s.a.a.h.a.a.c.i.s.DefaultAwsCrtV4aHttpSigner.signAsync(DefaultAwsCrtV4aHttpSigner.java:83)\n\tat s.a.a.c.i.h.p.s.AsyncSigningStage.doSraSign(AsyncSigningStage.java:132)\n\tat s.a.a.c.i.h.p.s.AsyncSigningStage.lambda$sraSignRequest$1(AsyncSigningStage.java:95)\n\t... 44 frames truncated (including 32 common frames)\nWrapped by: s.a.a.c.e.SdkClientException: Unable to execute HTTP request: null (SDK Attempt Count: 1)\n\tat s.a.a.c.e.SdkClientException$BuilderImpl.build(SdkClientException.java:130)\n\tat s.a.a.c.e.SdkClientException$BuilderImpl. build(SdkClientException.java:95)\n\tat s.a.a.c.i.h.p.s.u.RetryableStageHelper.retryPolicyDisallowedRetryException(RetryableStageHelper.java:168)\n\t... 39 frames truncated (including 6 common frames)\nWrapped by: j.l.RuntimeException: Error saving file to S3\n\tat c.n.b.s.AwsS3Service.lambda$saveFileToS3$2(AwsS3Service.java:42)\n\tat r.c.p.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)\n\tat r.c.p.MonoPeekTerminal$MonoTerm...\n

Everything works fine using the bucket name.

I can see that that DefaultAwsCrtV4aHttpSigner.signAsync is not implemented.

Is there a way of using mrap with the S3AsyncClient or should we use the synchrone one?

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

We can use mrap with S3AsyncClient

Current Behavior

Got an Authentication error (not implemented)

Reproduction Steps

   @Bean
    public SdkAsyncHttpClient asyncHttpClient() {
        return NettyNioAsyncHttpClient
                .builder()
                .eventLoopGroupBuilder(SdkEventLoopGroup.builder().numberOfThreads(Runtime.getRuntime().availableProcessors()))
                .connectionTimeout(Duration.ofMillis(5_000L))
                .maxConcurrency(500)
                .tlsNegotiationTimeout(Duration.ofMillis(3_500L)).build();
    }

    @Bean
    public S3AsyncClient s3AsyncClient(AwsS3Properties config, SdkAsyncHttpClient asyncHttpClient, AwsCredentialsProvider credentialsProvider) {
        final boolean useMRAP = config.bucket().startsWith("arn:aws:s3::") && config.bucket().contains(":accesspoint/");
        LOGGER.atInfo().setMessage("s3 - Role To Assume: {} - Region: {} - Use Multi-Region Access Point: {}")
                .addArgument(config::roleArn)
                .addArgument(config::region)
                .addArgument(useMRAP).log();
        return S3AsyncClient.builder()
                .httpClient(asyncHttpClient)
                .credentialsProvider(credentialsProvider)
                .region(config.region()).build();
    }

    @Bean
    public AwsCredentialsProvider credentialsProvider() {
        return WebIdentityTokenFileCredentialsProvider.create();
    }

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

2.32.7

JDK version used

21

Operating System and version

linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.p2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions