wkh237/react-native-fetch-blob

RNFetchBlobNetwork Method definitions not found

Opened this issue · 0 comments

Hi

First I would like to thank you for your work and this lib.

react-native-fetch-blob version

0.10.8

Environment:

OS: macOS High Sierra 10.13.4
Node: 9.8.0
Yarn: 1.5.1
Watchman: 4.9.0
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 2.3 AI-162.3764568

Packages: (wanted => installed)

react: 16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0

Issue

My App crashes sometimes due to this error (development and production):

@implementation RNFetchBlobNetwork
❗️ Method definition for 'enableProgressReport:' not found
❗️ Method definition for 'enableUploadProgress:' not found
❗️ Method definition for 'sendRequest' not found

Log:

2018-04-30 08:36:40.610470+0200 RepApp[847:394601] [BoringSSL] Function boringssl_session_errorlog: line 2878 [boringssl_session_write] SSL_ERROR_SYSCALL(5): operation failed externally to the library

My Code:
This Function is called over 150 times with await Promise.all(images.map(async (image) => {...}))

const fetchImage = async (image) => {
  try {
    const index: number = image.url.lastIndexOf('/');
    const fileName: string = image.url.substr(index + 1);
    const path = `${RNFS.CachesDirectoryPath}/${fileName}`;
    const accessToken = store.getState().login.loggedInfo.token;

    let result = await getResultFromRNFetchBlog(path, image.url, accessToken);

    if (result.info().status === 200) {
      result.session('productsImages');
      return update(image, {
        $merge: {
          path: result.path(),
        },
      });
    }
    if (result.info().status === 401) {
      result.flush();
      await store.dispatch(logIn());
      result = await getResultFromRNFetchBlog(fileName, image.url, accessToken);
      if (result.info().status === 200) {
        result.session('productsImages');
        return update(image, {
          $merge: {
            path: result.path(),
          },
        });
      }
      result.flush();
    }
    return update(image, { $merge: { path: '' } });
  } catch (e) {
    throw e;
  }
};

How to trigger

Can't tell how to trigger. In about 1 of 100 times this error happens. Wondering, why my try-catch blocks do not catches errors.