uploadInputStream idle after restoring internet access
Before opening, please confirm:
- [X] I have searched for duplicate or closed issues and discussions.
Language and Async Model
Not applicable
Amplify Categories
Storage
Gradle script dependencies
implementation 'com.amplifyframework:core:1.28.1'
implementation 'com.amplifyframework:aws-api:1.28.1'
implementation 'com.amplifyframework:aws-auth-cognito:1.28.1'
implementation 'com.amplifyframework:aws-datastore:1.28.1'
implementation 'com.amplifyframework:aws-storage-s3:1.28.1'
Environment information
------------------------------------------------------------
Gradle 7.3.3
------------------------------------------------------------
Build time: 2021-12-22 12:37:54 UTC
Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 1.8.0_331 (Oracle Corporation 25.331-b09)
OS: Mac OS X 12.3.1 x86_64
Please include any relevant guides or documentation you're referencing
https://docs.amplify.aws/lib/storage/upload/q/platform/android/#upload-files
Describe the bug
I would like to run the function uploadInputStream with no internet access so that it starts the upload as soon as internet connectivity is restored.
Most of the times this works fine, and the upload starts right when reconnecting, but sometimes the upload does not happen, and no value is returned either as a success or error.
Is there anyway I can handle these scenarios?
Reproduction steps (if applicable)
- Disconnect from WiFi and data (no internet access).
- Run
uploadInputStream - Re-connect. Most of the times it will commence the upload right away, but sometimes the function stays idle (neither success nor error is returned).
Code Snippet
// This way of setting a socket timeout is deprecated, we need to find another alternative
val awsS3StoragePlugin = Amplify.Storage.getPlugin("awsS3StoragePlugin") as AWSS3StoragePlugin
val client = awsS3StoragePlugin.escapeHatch
client.setConfiguration(ClientConfiguration().apply {
socketTimeout = 0
})
...
Amplify.Storage.uploadInputStream(key, stream,
{ onSuccess() },
{
Log.e("MyAmplifyApp", it.toString())
}
)
Log output
No response
amplifyconfiguration.json
No response
GraphQL Schema
// Put your schema below this line
Additional information and screenshots
No response
@banji180 any updates on this?
Hey @banji180 sorry to bug you again but I was wondering if you've had the time to check this issue. Thanks!
@sdhuka any updates? thanks!
@pcanas I will try to repro this on my end, but it would be helpful if you could share the logs after the device goes online to investigate why the upload is not resumed.
We tried to repro and could not repro on our end. It would be helpful if you could share the logs for us to investigate further.
@pcanas Closing this issue due to lack of information to diagnose the issue. We also recently re-architected the storage plugin implementation in Amplify 2.0 using the workmanager library which responds better to network changes, we highly recommend you to upgrade to 2.0 in case this issue persists.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.