aws-amplify / aws-amplify/amplify-android
Something went wrong with your AWS S3 Storage upload input stream operation - on some devices only
- Dominant language
- Java
- Stars
- 287
- Forks
- 132
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 45
Description
### Before opening, please confirm:
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-android/issues?q=is%3Aissue+) and [discussions](https://github.com/aws-amplify/amplify-android/discussions).
### Language and Async Model
Kotlin - Coroutines
### Amplify Categories
Storage
### Gradle script dependencies
```groovy
implementation 'com.amplifyframework:core-kotlin:2.7.1'
implementation 'com.amplifyframework:aws-auth-cognito:2.7.1'
implementation 'com.amplifyframework:aws-storage-s3:2.7.1'
```
### Environment information
```
------------------------------------------------------------
Gradle 8.0
------------------------------------------------------------
Build time: 2023-02-13 13:15:21 UTC
Revision: 62ab9b7c7f884426cf79fbedcf07658b2dbe9e97
Kotlin: 1.8.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.6 (JetBrains s.r.o. 17.0.6+0-17.0.6b802.4-9586694)
OS: Mac OS X 13.0.1 x86_64
```
### Please include any relevant guides or documentation you're referencing
_No response_
### Describe the bug
Hi !
I'm using the coroutines koltin sdk for uploading files (images/ video).
Everything is working well on any devices tested on my side (physical & simulated), from any Android version (API 26 -> 33).
My client located in French Polynesia, with a samsung A13 (Android 13), using wifi with good internet connection is not able to upload any file.
He keeps getting "Something went wrong with your AWS S3 Storage upload input stream operation" right away.
The content is either from his gallery or by capture intents.
I'm using the same amplifyconfiguration.json on iOS & Android, and there is no bug on iOS side.
Since I'm not able to reproduce this on my side, I don't have any logs for now.
I would consider remote debuging but my client is not really available to help me with this task.
Do you have any hint on what could cause this bug ? maybe a location related issue ?
He is not using any simcard (but neither do I on my test devices).
I don't have access to the backend unfortunately.
Thanks for your help,
Regards
### Reproduction steps (if applicable)
_No response_
### Code Snippet
```kotlin
class UploadDataSource @Inject constructor(private val application: Application) {
private val folder = "cache"
@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class)
fun uploadFile(file: File) : Storage.InProgressStorageOperation {
val options = StorageUploadInputStreamOptions.builder()
.accessLevel(StorageAccessLevel.PUBLIC).build()
val uuid = "${UUID.randomUUID()}"
val uploadFileName = "${uuid}.${file.extension}"
val uploadPath = "$folder/$uploadFileName"
return Amplify.Storage.uploadInputStream(uploadPath, application.contentResolver.openInputStream(file.toUri())!!, options)
}
}
```
### Log output
```
// Put your logs below this line
```
### amplifyconfiguration.json
```json
{
"UserAgent": "aws-amplify-cli/2.0",
"Version": "1.0",
"auth": {
"plugins": {
"awsCognitoAuthPlugin": {
"UserAgent": "aws-amplify/cli",
"Version": "0.1.0",
"IdentityManager": {
"Default": {}
},
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "XXXXXXXXXX",
"Region": "eu-west-3"
}
}
},
"CognitoUserPool": {
"Default": {
"PoolId": "XXXXXXXXXX",
"AppClientId": "XXXXXXXXXX",
"Region": "eu-west-3"
}
},
"Auth": {
"Default": {
"authenticationFlowType": "USER_SRP_AUTH",
"socialProviders": [],
"usernameAttributes": [],
"signupAttributes": [
"EMAIL"
],
"passwordProtectionSettings": {
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": []
},
"mfaConfiguration": "OFF",
"mfaTypes": [
"SMS"
],
"verificationMechanisms": [
"EMAIL"
]
}
},
"S3TransferUtility": {
"Default": {
"Bucket": "XXXXXXXXXX",
"Region": "eu-west-3"
}
}
}
}
},
"storage": {
"plugins": {
"awsS3StoragePlugin": {
"bucket": "XXXXXXXXXX"
"region": "eu-west-3",
"defaultAccessLevel": "guest"
}
}
}
}
```
### GraphQL Schema
```graphql
// Put your schema below this line
```
### Additional information and screenshots

Contributor guide
Research direction
Start by tracing Amplify.Storage.uploadInputStream from UploadDataSource and inspect how the ContentResolver input stream from file.toUri() is handled. Try to reproduce the failure on the reported Samsung A13 or collect diagnostics around the input-stream upload. Done means identifying the device-specific cause and verifying the upload behavior after the fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, aws, kotlin
- Domain
- cloud, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100