Skip to content

Method .asByteStream() does not working #1179

@z0mb1ek

Description

@z0mb1ek

Describe the bug

I try to put file to s3 with calling:

s3Client.putObject { bucket = "test" key = "test" body = Paths.get("032f8894-cb16-11ea-afb8-c247794642aa.dwg").asByteStream() } 

Expected behavior

put object to s3

Current behavior

i see error:

The request signature we calculated does not match the signature you provided. Check your AWS secret access key and signing method. For more information, see REST Authentication and SOAP Authentication for details.	at aws.sdk.kotlin.services.s3.serde.PutObjectOperationDeserializerKt.throwPutObjectError(PutObjectOperationDeserializer.kt:71)	at aws.sdk.kotlin.services.s3.serde.PutObjectOperationDeserializerKt.access$throwPutObjectError(PutObjectOperationDeserializer.kt:1)	at aws.sdk.kotlin.services.s3.serde.PutObjectOperationDeserializerKt$throwPutObjectError$1.invokeSuspend(PutObjectOperationDeserializer.kt)	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) 

Steps to Reproduce

put file from disk to s3

Possible Solution

it work only that way:

body = ByteStream.fromBytes(File("032f8894-cb16-11ea-afb8-c247794642aa.dwg").readBytes()) 

Context

No response

AWS Kotlin SDK version used

aws.sdk.kotlin:s3:1.0.35

Platform (JVM/JS/Native)

JVM

Operating System and version

MacOS, Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.closed-for-stalenessresponse-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