Skip to content

Tried to access a JS module before the React instance was fully set up #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fgeorgsson opened this issue May 3, 2018 · 4 comments · Fixed by #626
Closed

Tried to access a JS module before the React instance was fully set up #26

fgeorgsson opened this issue May 3, 2018 · 4 comments · Fixed by #626

Comments

@fgeorgsson
Copy link

fgeorgsson commented May 3, 2018

  • please provide the version of installed library and RN project.

[email protected] through [email protected].
[email protected]

Our app use react-native-cached-image to cache a bunch of images. Some are proloaded early on, when the app is rendered the first time.

Sometimes when the app starts, perhaps after a code-push, we get the error message below logged to Fabric. The app crashes.

I am pretty sure it only happens after a code-push is downloaded and the new js-app is restarted, but I'm not sure. It does not happen every time though, seems pretty rare, like 1/100 times a code-push is applied.

(https://github.com/Microsoft/react-native-code-push)

Fatal Exception: java.lang.RuntimeExceptionTried to access a JS module before the React instance was fully set up. Calls to ReactContext#getJSModule should only happen once initialize() has been called on your native module. Raw Text
--
  | com.facebook.react.bridge.ReactContext.getJSModule (ReactContext.java:105)
  | com.RNFetchBlob.RNFetchBlobReq.emitStateEvent (RNFetchBlobReq.java:627)
  | com.RNFetchBlob.RNFetchBlobReq.done (RNFetchBlobReq.java:455)
  | com.RNFetchBlob.RNFetchBlobReq.access$100 (RNFetchBlobReq.java:60)
  | com.RNFetchBlob.RNFetchBlobReq$3.onResponse (RNFetchBlobReq.java:423)
  | okhttp3.RealCall$AsyncCall.execute (RealCall.java:135)
  | okhttp3.internal.NamedRunnable.run (NamedRunnable.java:32)
  | java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133)
  | java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607)
  | java.lang.Thread.run (Thread.java:776)

Any ideas?

@ghsdh3409
Copy link

@PCguru Did you resolve this issue?

@The0racle
Copy link

I'm having the same issue. Did anyone find a fix for this?

@fgeorgsson
Copy link
Author

We've moved to https://www.npmjs.com/package/react-native-fast-image, no longer using rn-fetch-blob.

Did not find any solution all the way up to React Native 0.57 and about 50% of app crashes were related to rn-fetch-blob.

AlAskalany added a commit to AlAskalany/rn-fetch-blob that referenced this issue Jul 15, 2020
Avoid crashing the app when the event is called while the react context is not initialized.
jacobmllr95 pushed a commit to jacobmllr95/rn-fetch-blob that referenced this issue Aug 12, 2020
Avoid crashing the app when the event is called while the react context is not initialized.
@rahamin1
Copy link

Did anybody find a fix?
I am using version 0.12.0 and RN 0.62.2.

The error occurs only when I restart the app programmatically (using react-native-restart).

jacobmllr95 added a commit to jacobmllr95/rn-fetch-blob that referenced this issue Sep 28, 2020
This reverts commit 5ae3232.
rpenfold added a commit that referenced this issue Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants