Skip to content

AWS SDK Version Conflict / Incompatibility when Spring-AI (bedrock deps) are also included. #1686

Closed

Description

@mschout

Type: Bug

Component:
S3

Describe the bug
When used in combination with Spring-AI with its AWS Bedrock dependencies, the version of AWSSDK that gets pulled in is (as of this date, with Spring AI v 2.0.1) 2.51.2. Spring Cloud AWS requests version 2.47.4, but gradle picks the newer version of the SDK that Spring AI wants, and so, AWSSDK 2.51.2 ends up on the classpath instead of 2.47.4. When using S3Template, with AWS SDK 2.51.2, the following exception occurs:

java.lang.AbstractMethodError: Receiver class software.amazon.awssdk.services.s3.DefaultS3Client$$Lambda/0x0000000017e3c4e0 does not define or inherit an implementation of the resolved method 'abstract java.util.List resolve(software.amazon.awssdk.core.SdkRequest, software.amazon.awssdk.core.interceptor.ExecutionAttributes)' of interface software.amazon.awssdk.core.spi.identity.AuthSchemeOptionsResolver.
	at software.amazon.awssdk.core.internal.http.pipeline.stages.AuthSchemeResolutionStage.resolveAuthSchemeOptions(AuthSchemeResolutionStage.java:117)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.AuthSchemeResolutionStage.execute(AuthSchemeResolutionStage.java:70)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.AuthSchemeResolutionStage.execute(AuthSchemeResolutionStage.java:50)
	at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
	at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
	at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
	at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
	at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
	at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
	at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:53)
	at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:35)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.executeWithTimer(ApiCallTimeoutTrackingStage.java:82)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:62)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:43)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:49)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:32)
	at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
	at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:37)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:26)
	at software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient$RequestExecutionBuilderImpl.execute(AmazonSyncHttpClient.java:214)
	at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.invoke(BaseSyncClientHandler.java:103)
	at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.doExecute(BaseSyncClientHandler.java:173)
	at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$0(BaseSyncClientHandler.java:66)
	at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:182)
	at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:60)
	at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:52)
	at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:60)
	at software.amazon.awssdk.services.s3.DefaultS3Client.getObject(DefaultS3Client.java:7332)
	at software.amazon.awssdk.services.s3.S3Client.getObject(S3Client.java:12513)
	at software.amazon.awssdk.services.s3.S3Client.getObject(S3Client.java:12779)
	at io.awspring.cloud.s3.S3Resource.getInputStream(S3Resource.java:106)

Dependencies:

  • io.awspring.cloud:spring-cloud-aws-starter-s3:4.1.0
  • io.awspring.cloud:spring-cloud-aws-starter-sqs:4.1.0
  • org.springframework.ai:spring-ai-autoconfigure-model-tool:2.0.1
  • org.springframework.ai:spring-ai-starter-model-bedrock:2.0.1
  • org.springframework.ai:spring-ai-starter-model-bedrock-converse:2.0.1

Temporary Workaround:

in build.gradle.kts, to force use of 2.47.4:

implementation(enforcedPlatform( "io.awspring.cloud:spring-cloud-aws-dependencies:4.1.0"))

Ideally spring cloud aws requests or can work with the same version of awssdk that Spring-AI's bedrock deps pull in.

Activity

  1. franciscomelicias commented on Aug 25, 2026

    @franciscomelicias

    We are having the same issue in our project. Would be nice if we can do the upgrade so we can use the new version of Spring-AI

  2. mschout commented on Aug 25, 2026

    @mschout
    Author

    Bit more info after asking codex to trace down the incompatibility here, as the stack trace is deep inside the AWS SDK.

    The resolved runtime classpath has:

    • software.amazon.awssdk:s3:2.47.4
    • software.amazon.awssdk:sdk-core:2.51.2
    • Other shared SDK modules at a mixture of 2.47.4 (Spring Cloud AWS) and 2.51.2 (Spring-AI requested)

    And so, this is a binary incompatible mixture of AWS SDK dependencies.

    The failure mechanism (at least for my reported stacktrace) is is triggered by S3Resource.getInputStream() under this scenario.

    S3 2.47.4-generated lambda:

          resolve(SdkRequest)
    

    SDK Core 2.51.2 expects:

          resolve(SdkRequest, ExecutionAttributes)
    

    When the newer AuthSchemeResolutionStage invokes the two-argument method, the lambda generated by the older DefaultS3Client cannot implement it, producing AbstractMethodError. The trace is deep inside AWS because authentication resolution is the first point where that incompatible interface gets invoked. S3Resource.getInputStream() merely initiates the request.

    Spring Cloud AWS itself is behaving normally.

    The question then is what to do about it, and yes, ideally both Spring-AI and Spring Cloud AWS request the same SDK version. But meanwhile the choice is:

    • Enforce the version Spring Cloud AWS wants or,
    • Enforce the version Spring-AI wants.

    Hopefully the public API's are compatible between these two versions of the SDK.

    One way in gradle was the temporary workaround I posted earlier using enforcedPlatform. The other way would be to pick the SDK version that Spring-AI uses. Unforutnately, there is no easy way to pick the AWS SDK version out of the Spring-AI BOM that I could find so it has to be specified explicitly:

    e.g. in gradle/libs.versions.toml:

    [versions]
    # keep in sync with Spring-AI version
    aws-sdk = "2.51.2"
    
    [libraries]
    aws-sdk-bom = { module = "software.amazon.awssdk:bom", version.ref = "aws-sdk" }
    

    and then in build.gradle.kts:

    // Pin AWSSDK version. Keep in sync with Spring-AI requested AWS SDK version
    implementation(enforcedPlatform(libs.aws.sdk.bom))
    implementation(platform(libs.spring.cloud.aws.dependencies))
    

    And I would hope that any incompatibility is caught by a compile time error beyond that.

  3. mschout commented on Aug 25, 2026

    @mschout
    Author

    Not sure how to do the equivalent in maven for anyone that needs it. I'm using gradle, sorry.

  4. MatejNedic commented on Aug 25, 2026

    @MatejNedic
    Member

    Hey @mschout ,

    We are planning on doing release of 4.1.1 very soon so we will lift the dependency version.

  5. MatejNedic commented on Aug 28, 2026

    @MatejNedic
    Member

    Hello everyone.

    4.1.1 has been released with latest version of AWS sdk!
    Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions