Open yibo-long opened 1 week ago
Hi, thanks for the report. Have you tried using a custom endpoint provider with a fixed endpoint. There's an example of that here in our documentation.
It would look something like this:
S3Client.fromEnvironment {
endpointProvider = object : S3EndpointProvider {
override suspend fun resolveEndpoint(params: S3EndpointParameters): Endpoint = Endpoint("https://endpoint.example")
}
}
@0marperez thanks for the suggestion,I tried that it still running with endpoint discoverer:
TimestreamWriteClient {
region = awsRegion
timestreamEndpoint?.let { endpoint ->
endpointProvider = TimestreamWriteEndpointProvider {
Endpoint(endpoint)
}
}
}
As far as I can see the code won't skip discovery:
which will always try calling describeEndpoints regardless of TimestreamWriteEndpointProvider
:
With that said, I think it will be great either providing the similar logic with endpointDiscoveryEnabled
(which is mentioned to work in https://docs.aws.amazon.com/sdkref/latest/guide/feature-endpoint-discovery.html, however I couldn't find a way to set it in kotlin clients), or allowing overriding TimestreamWriteEndpointDiscoverer, which is currently a final class.
@yibo-long I am able to override TimestreamWriteEndpointDiscoverer
using this code:
TimestreamWriteClient.fromEnvironment {
region = "..."
endpointProvider = object : TimestreamWriteEndpointProvider {
override suspend fun resolveEndpoint(params: TimestreamWriteEndpointParameters): Endpoint = Endpoint("https://endpoint.example")
}
}
It's a bit different to what you have currently. In regards to disabling endpoint discovery, I see the issue you're having and I'll be working on correcting the documentation in the meantime and working on seeing how we can add the functionality
Hi @yibo-long just checking in, did the code above help you become unblocked?
Hi @0marperez, unfortunately no.
As you can see from my screenshot of the generated SDK code, val discoveredHost = cache.get(cacheKey) { discoverHost(client) }
is run before val originalEndpoint = delegate.resolve(request)
, and then delegate.resolve
calls endpointProvider.resolveEndpoint(params)
. discoverHost
will still throw error for java.lang.IllegalArgumentException: http://localhost:4566 is not a valid inet host
Quick update, we documented the bugs causing this issue and created internal issues to keep track of them (SDK-KT-354 and SDK-KT-359)
Describe the bug
When running with localstack-pro for Timestream, it throws below errors:
This happens for both timestream-query and timestream-write
the client is created as:
Regression Issue
Expected behavior
it should be run correctly as similar codes with
software.amazon.awssdk:timestreamwrite
orsoftware.amazon.awssdk:timestreamquery
.Current behavior
Throws the error.
Steps to Reproduce
run with the code below with localstack-pro testcontainer
Possible Solution
It seems to be that kotlin sdk didn't disable endpoint discovery like aws-sdk-java-v2:
for those EndpointDiscoverer in kotlin sdk, it should not try to discover host with describeEndpoints if endpoint is already overriden.
Context
No response
AWS SDK for Kotlin version
1.3.21
Platform (JVM/JS/Native)
JDK21
Operating system and version
linux/mac