apache / apache/cordova-plugin-file-transfer
Request Timeout on Big File (180MB)
- Dominant language
- JavaScript
- Stars
- 606
- Forks
- 874
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
```
[BackgroundTask] Background Task 1 ("Called by CordovaPlugins, from -[CDVFileTransfer uploadData:command:]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
NSURLConnection finished with error - code -1001
File Transfer Error: The request timed out.
```
### What is expected to happen?
Not timeout.
### What does actually happen?
Times out.
## Information
Using latest `master` branch code.
### Command or Code
Ensure file is large. If the timeout doesn't occur, increase file size. The current environment is in a K8's cluster, so there may be some overhead there on my end.
```
const fileURL = file:// ...
const options: FileUploadOptions = {
fileKey: 'file',
fileName: fileURL.substring(fileURL.lastIndexOf('/') + 1),
mimeType: 'text/plain',
};
// TODO Pass created uuid and version
const params: any = {};
params.value1 = 'test';
params.value2 = 'param';
options.params = params;
const ft = new FileTransferObject();
ft.upload(
fileURL,
encodeURI(`http://example.com`),
options,
);
```
### Environment, Platform, Device
K8's/Docker with iOS, iPad Pro 12.9
### Version information
cordova-plugin-file: 6.0.2
cordova-plugin-file-transfer: github:apache/cordova-plugin-file-transfer#master
Capacitor: 3.2.4
Ionic: 5.8.4
Ionic CLI: 6.17.1
XCode: 13
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start by reproducing the 180MB upload through FileTransferObject.upload and inspect the iOS entry point named -[CDVFileTransfer uploadData:command:], focusing on the timeout and background-task messages. Compare behavior for smaller and larger files in the listed Cordova, Capacitor, and iOS environment; done means the large upload no longer fails with request timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, objective-c
- Domain
- mobile, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100