opensearch-project / opensearch-project/opensearch-java
[BUG] AwsSdk2Transport doesn't work with AwsSdk below 2.25.0
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 165
- Forks
- 250
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 26
Description
What is the bug?
Actually, it’s not really a bug. I think it’s an intended behavior that AwsSdk2Transport doesn’t work with AwsSdk below version 2.25.0, since that version is already quite old.
In the prepareRequest method of the AwsSdk2Transport class, the ContentStreamProvider interface calls the fromByteArrayUnsafe method. However, this method was introduced in AwsSdk2 after version 2.26.0.
Therefore, when using AwsSdk below 2.25.0, a NoSuchMethodError will occur when AwsSdk2Transport executes the prepareRequest method.
For clarification, it would be better to mention in the README which versions of AwsSdk2 are supported, so that users with older versions (below 2.25.0) can be aware of this limitation.
How can one reproduce the bug?
Inject SdkHttpClient of AwsSdk 2.25.0 into AwsSdk2Transport and then, call prepareRequest method.
SdkHttpClient httpClient =
ApacheHttpClient.builder()
.buildWithDefaults(
AttributeMap.builder()
.put(SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES, true)
.build());
AwsSdk2Transport transport =
new AwsSdk2Transport(
httpClient,
server.httpsUri().toString().replace("https://", ""),
Region.AP_NORTHEAST_1,
AwsSdk2TransportOptions.builder().setCredentials(CREDENTIALS_PROVIDER).build());
What is the expected behavior?
Mentioning which versions of AwsSdk2 are supported in README.
What is your host/environment?
Mac OS 15.3.1
Do you have any screenshots?
'software.amazon.awssdk.http.ContentStreamProvider software.amazon.awssdk.http.ContentStreamProvider.fromByteArrayUnsafe(byte[])'
java.lang.NoSuchMethodError: 'software.amazon.awssdk.http.ContentStreamProvider software.amazon.awssdk.http.ContentStreamProvider.fromByteArrayUnsafe(byte[])'
at org.opensearch.client.transport.aws.AwsSdk2Transport.prepareRequest(AwsSdk2Transport.java:348)
at org.opensearch.client.transport.aws.AwsSdk2Transport.performRequest(AwsSdk2Transport.java:215)
Do you have any additional context?
Add any other context about the problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by checking the README for the AwsSdk2Transport dependency or compatibility documentation, then review AwsSdk2Transport.prepareRequest and the reported ContentStreamProvider method version. Document the supported AWS SDK versions, including the minimum version that provides fromByteArrayUnsafe, and confirm the README clearly warns users of older versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, java
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100