-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 Endpoint URL does not with localstack #1124
Comments
Hi @hantsy, I'm not able to replicate this using the latest version of the SDK and LocalStack. I can make S3 requests to my local stack such as Here is my small sample. I used val client = S3Client.fromEnvironment {
credentialsProvider = StaticCredentialsProvider(credentials = Credentials("foo", "bar", "baz"))
endpointUrl = Url.parse("http://localhost:4566")
forcePathStyle = true
region = "us-east-1"
}
try {
client.headBucket {
bucket = "non-existent-bucket"
}
} catch (e: Exception) {
println("Bucket does not exist")
}
println(client.listBuckets{}) I modified this code to also create a bucket, and verified that the HeadBucket operation was successful. Can you please try my simplistic example to see if it works for you? That would help narrow down the root cause of your issues. Also, double check to make sure your versions are all set to the latest (LocalStack Also, can you share what is the latest version of the SDK where this did work for you? It can help us narrow down changes which may have caused this breakage for you. |
I also tried to use @Bean
fun awsS3Client(awsCredentialsProvider: CredentialsProvider, properties: AwsProperties): S3Client {
return S3Client {
credentialsProvider = awsCredentialsProvider
region = properties.region
// endpointProvider = properties.endpoint?.let { url ->
// S3EndpointProvider { Endpoint(url) }
// } ?: DefaultS3EndpointProvider()
endpointUrl= properties.endpoint?.let { Url.parse(it) }
forcePathStyle = !properties.endpoint.isNullOrBlank()
logMode = LogMode.LogRequestWithBody
}
} It seems the credentialsProvider is a little different. fun awsCredentialsProvider(properties: AwsProperties): CredentialsProvider {
val chain = CredentialsProviderChain(
EnvironmentCredentialsProvider(),
StaticCredentialsProvider(
Credentials(
secretAccessKey = properties.secretAccessKey,
accessKeyId = properties.accessKeyId
)
)
)
return CachedCredentialsProvider(chain)
} |
@lauzadis I add Github action workflow file, it build successfully on Github action. I realize it is my fault. On my local machine, I was always using a VPN proxy client, but not sure now the Proxy settings affect the AWS S3 Client connection. |
Great, I'm happy you were able to resolve the problem! |
|
Hi, we are using Aws SDK Kotlin to handle the AWS operations in our project, but update to the latest AWS SDK Kotlin 0.35-beta, we will face the endpoint url setting as pathstyle or host style, but either use current
http://localhost:4566
orhttp://s3.localhost.localstack.cloud:4566
, when running my tests locally I got exception like this.Before storing files into S3, we use a headbucket to check the existence of bucket name, if it is not existed, created one, but the headbucket code caused the exception.
Any S3Client function will raise an exception, and I can not see any log from the localstack console(I am using a LocalStack v3 from Docker).
Originally posted by @hantsy in #1121
The text was updated successfully, but these errors were encountered: