Unable to upload files with FileSystem.uploadAsync()

SDK Version: 42
Expo File System: 11.1.3
Platform: iOS

Hello, when uploading files with FileSystem.uploadAsync() the upload fails sometimes with the error

Error Uploading:  [Error: Unable to upload the file: 'Error Domain=NSURLErrorDomain Code=-997 "Lost connection to background transfer service" UserInfo={NSErrorFailingURLStringKey=<REDACTED>, NSErrorFailingURLKey=<REDACTED>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <A58C81B8-D52F-461C-BB53-2AFB5BAE5E3B>.<5>"
), _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <A58C81B8-D52F-461C-BB53-2AFB5BAE5E3B>.<5>, NSLocalizedDescription=Lost connection to background transfer service}']

My code looks like this:

          headers: {
            "Content-Type": "multipart/form-data",
          uploadType: FileSystemUploadType.MULTIPART,
          fieldName: "video",
          parameters: ...

I am wondering why this error occurs very inconsistently and how deal with it.

Hey @ginimed, a couple questions for ya!

  1. What iOS version(s) have you encountered this on? Also, what device(s)?
  2. Can you see if locking the screen of the device has an influence of the rate the error occurs? After perusing some posts on the Apple forums, it seems that in the past locking the screen has been a cause for the -997 error code.


Hey @adamjnav,

thanks for your reply.

I‘ve tested on an iPhone XS with iOS 14.7.1.

Locking the screens seems to have no effect. Weirdly the upload crashes most of time time after a couple of seconds. But I also recognized that the larger the file the more often the problem occurs. Connection to a charger or wifi vs lte does not seem to have an effect.

Anything else you think that cause this or habe have an effect? Maybe some setting that is missing on the native side?


@adamjnav This is a very critical issue for me. What can I do do speed up the resolution process? Will a priority membership help and guarantee a solution?

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