Skip to content
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

SendCountExceedException when accessing S3 bucket in another region via Ktor client #527

Closed
ianbotsf opened this issue Feb 14, 2022 · 3 comments
Assignees
Labels
bug This issue is a bug.

Comments

@ianbotsf
Copy link
Contributor

ianbotsf commented Feb 14, 2022

Describe the bug

When attempting to read from an S3 bucket hosted in a different region than the client configuration using the Ktor client engine, the following error is observed:

io.ktor.client.features.SendCountExceedException: Max send count 20 exceeded. Consider increasing the property maxSendCount if more is required.

This error is unintuitive and does not correctly indicate the problem or any possible resolutions.

Expected behavior

The API call should throw a clearer error indicating the problem (missing endpoint configuration and/or incorrect region).

Current behavior

The following error is thrown:

Exception in thread "main" io.ktor.client.features.SendCountExceedException: Max send count 20 exceeded. Consider increasing the property maxSendCount if more is required.
	at io.ktor.client.features.HttpSend$DefaultSender.execute(HttpSend.kt:121)
	at io.ktor.client.features.HttpRedirect$Feature.handleCall(HttpRedirect.kt:95)
	at io.ktor.client.features.HttpRedirect$Feature.access$handleCall(HttpRedirect.kt:47)
	at io.ktor.client.features.HttpRedirect$Feature$handleCall$1.invokeSuspend(HttpRedirect.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:15)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Steps to Reproduce

suspend fun main() {
    val globalConfig = AwsClientConfig.fromEnvironment { }
    val s3 = S3Client(globalConfig) {
        httpClientEngine = KtorEngine()
    }
    s3.getObject(GetObjectRequest {
        bucket = "aws-sdk-kotlin-api-docs" // Bucket hosted in another region
        key = "foo"
    }) { }
}

Possible Solution

No response

Context

Originally noted in #525.

AWS Kotlin SDK version used

0.12.0-beta

Platform (JVM/JS/Native)

JVM

Operating System and version

Amazon Linux 2

@ianbotsf ianbotsf added the bug This issue is a bug. label Feb 14, 2022
@ianbotsf ianbotsf changed the title SendCountExceedExcepotion when accessing S3 bucket without permissions via Ktor client SendCountExceedException when accessing S3 bucket without permissions via Ktor client Feb 14, 2022
@ianbotsf ianbotsf changed the title SendCountExceedException when accessing S3 bucket without permissions via Ktor client SendCountExceedException when accessing S3 bucket in another region via Ktor client Feb 14, 2022
@ianbotsf ianbotsf self-assigned this Feb 14, 2022
@ianbotsf
Copy link
Contributor Author

PR in smithy-kotlin#590.

@ianbotsf
Copy link
Contributor Author

PR approved and pushed to smithy-kotlin/main. This fix will be in the next SDK release.

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

1 participant