Method .asByteStream() does not working
z0mb1ek opened this issue · comments
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
Hi, thanks for the bug report. I was not able to replicate this. I am able to make s3:PutObject
requests using a body created from Paths.get(...).asByteStream()
. I added a new test to our end-to-end test suite and it also passed.
Can you share more information about your setup? Do your requests fail for all types of files uploaded?
It looks like this issue has not been active for more than 5 days. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please add a comment to prevent automatic closure, or if the issue is already closed please feel free to reopen it.
I've been faced with the same issue.
- ByteStream.fromFile(data.file) had been worked for about 2 months and suddenly became fire the error
- ByteStream.fromBytes(data.file.readBytes()) works perfect.
@fmaxx are you able to provide repro steps for this issue? If so please open a new bug report with the details.