aws-amplify / aws-amplify/amplify-android
No timeout or connection error (if internet is off/ unavailable) while downloading using Amplify.Storage.downloadFile()
- 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
### Amplify Categories
Storage
### Gradle script dependencies
```groovy
// Put output below this line
// Amplify core dependency
implementation 'com.amplifyframework:core:1.18.0'
implementation 'com.amplifyframework:aws-auth-cognito:1.18.0'
implementation 'com.amplifyframework:aws-storage-s3:1.18.0'
```
### Environment information
```
# Put output below this line
Welcome to Gradle 6.5!
Here are the highlights of this release:
- Experimental file-system watching
- Improved version ordering
- New samples
For more details see https://docs.gradle.org/6.5/release-notes.html
------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_242-release (JetBrains s.r.o 25.242-b01)
OS: Windows 10 10.0 amd64
```
### Please include any relevant guides or documentation you're referencing
https://docs.amplify.aws/lib/storage/download/q/platform/android
### Describe the bug
There is no storage exception or error is thrown if Internet/Network is not available.
Amplify.Storage.downloadFile() just waits till network is available, and resumes the download process.
I need to tell the user if network is not available, not just postpone the task later.
Also it would be necessary to specify timeout for download request, currently there is no way to do it.
Amplify.Storage.listFiles() throws StorageException while Internet/Network is not available or lost, Need same functionality in downloadFile() or uploadFile().
Also let me know if there is any default request timeout in Storage.downloadFile(), I've waited for hours but no exception or error is thrown.
### Reproduction steps (if applicable)
_No response_
### Code Snippet
```java
// Put your code below this line.
Amplify.Storage.downloadFile(item.key, file, S3optionsForDownload,
{ Log.i("Download", "Fraction completed: ${it.fractionCompleted}") },
{ Log.i("Download", "Successfully downloaded: ${it.file.name}") },
{ Log.e("Download", "Download Failure: ", it) }
)
```
### Log output
```
// Put your logs below this line
```
### amplifyconfiguration.json
_No response_
### GraphQL Schema
```graphql
// Put your schema below this line
```
### Additional information and screenshots
_No response_
Contributor guide
Research direction
Start with Amplify.Storage.downloadFile() and compare its unavailable-network behavior with Amplify.Storage.listFiles(), which the report says raises StorageException. Review the linked Storage download documentation and determine the expected error and timeout behavior for downloads and uploads. Done means unavailable or lost connectivity produces an observable failure rather than waiting indefinitely, with coverage for the reported behavior.
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
- Mostly clear
- Newbie friendliness
- 35/100