Skip to content

S3 Endpoint URL does not with localstack #1124

@lauzadis

Description

@lauzadis

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 or http://s3.localhost.localstack.cloud:4566, when running my tests locally I got exception like this.

ws.sdk.kotlin.services.s3.model.S3Exception: Failed to parse response as 'restXml' error
	at aws.sdk.kotlin.services.s3.serde.HeadBucketOperationDeserializerKt.throwHeadBucketError(HeadBucketOperationDeserializer.kt:46)
	at aws.sdk.kotlin.services.s3.serde.HeadBucketOperationDeserializerKt.access$throwHeadBucketError(HeadBucketOperationDeserializer.kt:1)
	at aws.sdk.kotlin.services.s3.serde.HeadBucketOperationDeserializer.deserialize(HeadBucketOperationDeserializer.kt:24)
	at aws.smithy.kotlin.runtime.http.operation.SdkOperationExecutionKt$decorate$3.invoke(SdkOperationExecution.kt:192)
	at aws.smithy.kotlin.runtime.http.operation.SdkOperationExecutionKt$decorate$3.invoke(SdkOperationExecution.kt:192)
...

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.

suspend fun S3Client.bucketExists(s3bucket: String) = try {
    headBucket(HeadBucketRequest { bucket = s3bucket })
    true
} catch (e: Exception) {
    false
}

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

Metadata

Metadata

Assignees

Labels

needs-triageThis issue or PR still needs to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions