itinance / itinance/react-native-fs
DownloadFile Unhandled Promise Rejection
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Dependencies:
```
"react-native": "0.61.2",
"react-native-fs": "^2.14.1"
```
Node version: `10.15.3`
I am using the `downloadFile` function as such:
```
const result: {
jobId: number;
promise: Promise;
} = await RNFS.downloadFile({
toFile,
headers: {
Accept: 'application/pdf',
},
background: true,
cacheable: true,
discretionary: true,
connectionTimeout: 120,
progressDivider,
progress: this.onDownloadProgress,
}).promise
```
within a React component. When I fire this function, I *sometimes* immediately receive the following error in the metro bundler output logger (new feature of RN v0.61.2)
```
Possible Unhandled Promise Rejection (id: 0):
TypeError: null is not an object (evaluating 'segments[key].toString')
logException@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:119853:30
logError@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:136781:54
_callee10$
tryCatch@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:25733:23
invoke@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:25908:32
tryCatch@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:25733:23
invoke@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:25809:30
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:25821:21
tryCallOne@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:27088:16
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:27189:27
_callTimer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:30643:17
_callImmediatesPass@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:30679:19
callImmediates@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:30898:33
callImmediates@[native code]
__callImmediates@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2695:35
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2472:34
__guard@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2678:15
flushedQueue@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2471:21
flushedQueue@[native code]
invokeCallbackAndReturnFlushedQueue@[native code]
```
`segments[key]` is null somewhere, and there is no reference to `segments` anywhere in my project. Any thoughts on what the underlying issue could be? Help is much appreciated.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.