Skip to content

HeadObject 403 throws Service returned error code 403: Forbidden, Error type: Unknown, Protocol response: HTTP 403 Forbidden #1640

@ckrgithub

Description

@ckrgithub

Describe the bug

I found that one android device has this problem, but other android devices are fine. The android device with problems will be fine after being restored to factory Settings

Download error : aws.sdk.kotlin.services.s3.model.S3Exception: Service returned error code 403: Forbidden, Error type: Unknown, Protocol response: HTTP 403 Forbidden, Request ID: 77Z6MWJM9PHWGK0D, Extended request ID: ZRw+qr6JQCgdAC22EBYCv/TSvs2ZutWewhUCrUdujEx1EdRU2ov/uUrddmweQIfARv5BZumwXRlfSEqjfK1Pd0aVO/xNe1cJjBG9g0jt/PI=
07-04 22:22:13.432  6002  6107 E Logger  : │    at aws.sdk.kotlin.services.s3.serde.HeadObjectOperationDeserializerKt.throwHeadObjectError(HeadObjectOperationDeserializer.kt:116)
07-04 22:22:13.432  6002  6107 E Logger  : │    at aws.sdk.kotlin.services.s3.serde.HeadObjectOperationDeserializerKt.access$throwHeadObjectError(HeadObjectOperationDeserializer.kt:1)
07-04 22:22:13.433  6002  6107 E Logger  : │    at aws.sdk.kotlin.services.s3.serde.HeadObjectOperationDeserializer.deserialize(HeadObjectOperationDeserializer.kt:34)
07-04 22:22:13.433  6002  6107 E Logger  : │    at aws.sdk.kotlin.services.s3.serde.HeadObjectOperationDeserializer.deserialize(HeadObjectOperationDeserializer.kt:29)
07-04 22:22:13.433  6002  6107 E Logger  : │    at aws.smithy.kotlin.runtime.http.operation.DeserializeHandler.call(SdkOperationExecution.kt:347)
07-04 22:22:13.433  6002  6107 E Logger  : │    at aws.smithy.kotlin.runtime.http.operation.DeserializeHandler$call$1.invokeSuspend(Unknown Source:15)
07-04 22:22:13.433  6002  6107 E Logger  : │    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
07-04 22:22:13.433  6002  6107 E Logger  : │    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
07-04 22:22:13.433  6002  6107 E Logger  : │    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
07-04 22:22:13.433  6002  6107 E Logger  : │    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
07-04 22:22:13.433  6002  6107 E Logger  : │    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
07-04 22:22:13.433  6002  6107 E Logger  : │    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
07-04 22:22:13.433  6002  6107 E Logger  : │    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
07-04 22:22:13.434  6002  6107 E Logger  : │    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected behavior

HeadObject can be accessed normally

Current behavior

Download error : aws.sdk.kotlin.services.s3.model.S3Exception: Service returned error code 403: Forbidden, Error type: Unknown, Protocol response: HTTP 403 Forbidden, Request ID: 77Z6MWJM9PHWGK0D

Steps to Reproduce

  1. implementation 'aws.sdk.kotlin:s3:1.4.16'
  2. Code usage:
val build = StaticCredentialsProvider.Builder().apply {
    accessKeyId = accessKey
    secretAccessKey = secretKey
    sessionToken = awsToken
}
val credentialsProvider = build.build()
val s3ClientApk = S3Client {
    this.region = region
    this.credentialsProvider = credentialsProvider
}
val header = HeadObjectRequest {
    this.bucket = bucketName
    this.key = key
}
val response = s3ClientApk.headObject(header)

Possible Solution

No response

Context

No response

AWS SDK for Kotlin version

aws.sdk.kotlin:s3:1.4.16

Platform (JVM/JS/Native)

JVM

Operating system and version

Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.closed-for-stalenessp3This is a minor priority issueresponse-requestedWaiting on additional info and feedback. Will move to 'closing-soon' in 5 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions