Closed narayanjr closed 8 years ago
@narayanjr Let me see if I can reproduce the problem.
I can not reproduce the problem and I can upload my slack avatar without a problem. Could you post the result from your log file?
This is the "original xml" logged message and the example image that generated this message.
<Error>
<Code>XAmzContentSHA256Mismatch</Code>
<Message>The provided 'x-amz-content-sha256' header does not match what was computed.</Message>
<ClientComputedContentSHA256>6d32a470a69d0c3af4b345e8a543ede0a425180bca616eba903ba32f35ee31b2</ClientComputedContentSHA256>
<S3ComputedContentSHA256>949d177392b7651e8c1fa67239a777f2b9fb2e6f5b9898e83a74dab01f5f010c</S3ComputedContentSHA256>
<RequestId>16ACAA3A2A2AE950</RequestId>
<HostId>QJUy+PYrgOuFKw6mIwDBA9WVXIkRJH3cQx/znKhqCT0X9LtwVmc6bmmH3HJqO/38znbGvXtp0TA=</HostId>
</Error>
Hmmm, I just created another play project just to test this single thing and it seems to work as expected there. So there is something wrong with my other app. However I have no idea how/why it's sha256 hash could be different.
Ohw, that is nasty. Those types of bugs are very hard to trace.
A few things to check:
Array[Byte]
is the same before and after the Future
completesplay.ws
properties in the configurationI can not think of anything else. If none of the above works, remove halves of the code until you find the offending part (binary search). Please report back once you found the problem so others don't need to go through the same struggle.
So I ended up resorting to cloning the broken project and slowly working my way to making both the working example and broken project look identical. After doing this for a few hours I finally managed to find the 1 thing that was different between the 2 projects.
My working example was using Play 2.4.2 while my broken App was using 2.4.1.
Here is a bare minimum example of this issue, https://github.com/narayanjr/play-s3-test
I have no idea why the issue exists but changing the Play version fixes it.
Wow, good find. Thank you for reporting back. It seems to be this commit: Post binary data 'as is'.
And a good reminder for me to also test with the exact play versions when reproducing bug reports.
Using Play 2.4.1 and play-s3 version 7.0.2
I am able to upload text files just fine, but when I try anything more complex, images, .ods, .jar files it fails with this error
The provided 'x-amz-content-sha256' header does not match what was computed.
If I swap "avatar.jpeg" for "text.txt" and "image/jpeg" for "plain/text" in the following code it works. The text file gets uploaded to S3. But if I try and upload any thing else it fails saying the header doesn't match. I've tried png, jpg, jpeg, ods, and jar files.