Unable to download file "unsupported URL"

Please provide the following:

  1. SDK Version: 40.0.1
  2. Platforms: Android/iOS

Hi,
With my last upgrade from SDK37 to SDK40, I’m now getting the bellow errors when calling FileSystem.downloadAsync with same code base.
Use case is to cache images locally and re-display them later.

Any idea what might be happening here? Are file paths not supported anymore?

iOS Error:

Unable to download file: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSErrorFailingURLStringKey=file:///var/mobile/Containers/Data/Application/someGUID/Library/Caches/ExponentExperienceData/%2540myCompany%252FMyApp/ExponentAsset-390a0721d16c652a3e1ef09d67b8d189.png, NSErrorFailingURLKey=file:///var/mobile/Containers/Data/Application/someGUID/Library/Caches/ExponentExperienceData/%2540myCompany%252FMyApp/ExponentAsset-390a0721d16c652a3e1ef09d67b8d189.png, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundDownloadTask <C5381452-F0F0-4AF5-A74C-550C18926BCF>.<181>"
), _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundDownloadTask <C5381452-F0F0-4AF5-A74C-550C18926BCF>.<181>, NSLocalizedDescription=unsupported URL}

Stack trace:
  node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:103:50 in promiseMethodWrapper
  node_modules\@unimodules\react-native-adapter\build\NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
  node_modules\expo-file-system\build\FileSystem.js:105:17 in downloadAsync
  node_modules\regenerator-runtime\runtime.js:45:36 in tryCatch
  node_modules\regenerator-runtime\runtime.js:274:29 in invoke
  node_modules\regenerator-runtime\runtime.js:45:36 in tryCatch
  node_modules\regenerator-runtime\runtime.js:135:27 in invoke
  node_modules\regenerator-runtime\runtime.js:170:16 in PromiseImpl$argument_0
  node_modules\react-native\node_modules\promise\setimmediate\core.js:45:6 in tryCallTwo
  node_modules\react-native\node_modules\promise\setimmediate\core.js:200:22 in doResolve
  node_modules\react-native\node_modules\promise\setimmediate\core.js:66:11 in Promise
  node_modules\regenerator-runtime\runtime.js:169:15 in callInvokeWithMethodAndArg
  node_modules\regenerator-runtime\runtime.js:192:38 in enqueue
  node_modules\regenerator-runtime\runtime.js:219:8 in exports.async
  node_modules\expo-file-system\build\FileSystem.js:101:7 in downloadAsync
  node_modules\react-native-sectioned-multi-select\lib\sectioned-multi-select.js:100:2 in <global>
  node_modules\regenerator-runtime\runtime.js:45:36 in tryCatch
  node_modules\regenerator-runtime\runtime.js:274:29 in invoke
  node_modules\regenerator-runtime\runtime.js:45:36 in tryCatch
  node_modules\regenerator-runtime\runtime.js:135:27 in invoke
  node_modules\regenerator-runtime\runtime.js:145:18 in PromiseImpl.resolve.then$argument_0
  node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
  node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
  node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
  node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
  node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
  [native code]:null in flushedQueue
  [native code]:null in invokeCallbackAndReturnFlushedQueue
  ...

Android Error:

Expected URL scheme 'http' or 'https' but was 'file'
2 Likes

Hey @apps.genie, could you provide a minimal reproducible example of this that I could run on my end?

Cheers,
Adam

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.