Closed salva116ario closed 3 months ago
Hello thank you for creating this issue. Someone from our team will take look at this issue.
I believe this may be related to the specific contents of a file being uploaded. To help narrow down the potential cause of the issue, would it be possible for you to verify the integrity of the file contents? Here are a few steps that could help us diagnose the issue further:
Manual Upload Test: Could you attempt to manually upload the file using the S3 console? This can help us determine if the issue lies with the file itself or the way the SDK is handling the upload.
File Integrity Check: Before uploading, could we perform a checksum comparison (e.g., using MD5) of the file on the client side and then again after uploading (if possible) to ensure the file has not been corrupted during the process?
SDK Configuration: Please let me know if there are any specific SDK configurations or settings that I should double-check on my end that might affect the upload process.
Hello @salva116ario,
Hi, @ankpshah thank you for considering my request.
One way to reproduce my problem is, by example, to use these two files :
ko.log (... a file for which upload task fails) ok.log (... with this file, all it's OK !)
I can uplaod ok.log from my Android mobile app to my s3 bucket using your lib (so, upload from mobile device storage to s3 bucket) And I can uplaod ok.log from my PC (Windows) to my s3 bucket using WinSCP (so, from my PC storage to s3 bucket...)
But, with ko.log, the upload fails using both WinSCP (throws Internal Error) and from mobile app (but no error thrown).
It's tricky but it seems there is something wrong with this line in ko.log : at java.lang.Thread.run(Thread.java:764)
Now, note that the same ko.log file can be uploaded on another bucket from a SpringBoot app. So, if there is a problem with the content file, it seems that it happens only in some cases and then, we're currently trying to check our bucket configuration...
And, at last, i precise that if ko.log file is zipped before the upload, it works fine...
I'll keep you posted on the progress of our research as soon as possible.
Hi, @ankpshah,
we have finally understood why uploads fail for some files such as ko.log: it's actually because of the configuration of the waf (Web Application Firewall), which considers that these files present a potential security risk. The waf therefore blocks the upload but returns a 200 response, which explains why the upload is considered finalised in your code.
I can therefore close this issue.
Thank you.
Describe the bug
I use aws-android-sdk-s3 in an Android mobile application to upload a text file from the mobile device to my s3 bucket. The text file i want to upload has always the same path on mobile device: /data/data/{{my_app_package}}/files/atlasmobile.log
Using aws-android-sdk-s3 version 2.22.1, i noticed that upload systematically fails with some text files. It seems I encountered the same problem as described in #717: ETag is null in the returned object metadata, then in putObject method, the line
throws NPE (but contrary to what was indicated in #717 , in my case, file is not uploaded correctly...)
With aws-android-sdk-s3 updated in version 2.74.0, I still have the same problem of upload failure for some files, even though no exceptions are thrown.
To Reproduce
Here is an example of file content for which uploadTask fails systematically : (call him FAIL_CONTENT)
Now, an example of file content for which uploadTask is OK: (call him CONTENT_OK : it looks like first content, minus some lines in the error stacktrace...)
Here is the method called in my app when i want to upload file :
To summarize :
with version 2.22.1 of aws-android-sdk-s3, there is a NPE on BinaryUtils.fromHex(returnedMetadata.getETag()); and in my app code i'm on the onError method inside uploadFile...
with version 2.74.0 of aws-android-sdk-s3, without exception (once uploadTask is finished, in my app code, i'm in the onStateChanged method with status == TransferState.COMPLETED)
Note that, with these 2 versions, as described in #717 returned object metadata etag is null. You can see it in SceenShots section.
Which AWS service(s) are affected? S3 upload
Expected behavior Successful upload ! :)
Screenshots
is returnedMetadata.metadata =
is returnedMetadata.metadata =
As you can see, there seems to be some formatting differences and "etag" field is missing here (as in #717 ).
Environment Information (please complete the following information):
Additional context Add any other context about the problem here.