Skip to content
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

App crash with react native integration #468

Closed
qbig opened this issue Jan 12, 2016 · 8 comments
Closed

App crash with react native integration #468

qbig opened this issue Jan 12, 2016 · 8 comments

Comments

@qbig
Copy link
Contributor

qbig commented Jan 12, 2016

App crash everytime once started. Using 2.0.4 and react native pluggin

var Raven = require('raven-js');
require('raven-js/plugins/react-native')(Raven);
Raven
  .config('https://https://[email protected]/xxxx', { release: RELEASE_ID })
  .install();
01-12 09:24:15.371 19126-19167/com.rnmenu E/ReactNative: Got JS Exception: TypeError: undefined is not a function (evaluating 'this._handleStackInfo(n,t)')
01-12 09:24:15.371 19126-19167/com.rnmenu W/dalvikvm: threadid=19: thread exiting with uncaught exception (group=0xa4d34b20)
01-12 09:24:15.411 19126-19167/com.rnmenu E/AndroidRuntime: FATAL EXCEPTION: mqt_js
                                                            Process: com.rnmenu, PID: 19126
                                                            com.facebook.react.bridge.JSExecutionException: TypeError: undefined is not a function (evaluating 'this._handleStackInfo(n,t)') (line 19 in the generated bundle)
                                                                at com.facebook.react.bridge.ReactBridge.loadScriptFromAssets(Native Method)
                                                                at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:32)
                                                                at com.facebook.react.bridge.CatalystInstance$2.run(CatalystInstance.java:138)
                                                                at android.os.Handler.handleCallback(Handler.java:733)
                                                                at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                                at android.os.Looper.loop(Looper.java:136)
                                                                at com.facebook.react.bridge.queue.MessageQueueThread$1.run(MessageQueueThread.java:137)
                                                                at java.lang.Thread.run(Thread.java:841)

benvinegar added a commit that referenced this issue Jan 12, 2016
Fix bad `this` value in React native plugin (fixes #468)
@qbig
Copy link
Contributor Author

qbig commented Jan 14, 2016

Hi @benvinegar . Thanks for the super prompt update. The crashing is fixed :) But as I was not receiving any event, I added an "throw new Error('test')", just to verify that sentry is properly setup. But I wasn't getting any event still. The following is the error log.

01-14 02:43:35.120 7612-7641/com.rnmenu E/AndroidRuntime: FATAL EXCEPTION: mqt_js
                                                          Process: com.rnmenu, PID: 7612
                                                          com.facebook.react.bridge.JSExecutionException: TypeError: undefined is not an object (evaluating 'e.exception.values[0].stacktrace.frames') (line 20 in the generated bundle)
                                                              at com.facebook.react.bridge.ReactBridge.callFunction(Native Method)
                                                              at com.facebook.react.bridge.CatalystInstance$3.run(CatalystInstance.java:180)
                                                              at android.os.Handler.handleCallback(Handler.java:733)
                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                              at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                              at android.os.Looper.loop(Looper.java:136)
                                                              at com.facebook.react.bridge.queue.MessageQueueThread$1.run(MessageQueueThread.java:137)
                                                              at java.lang.Thread.run(Thread.java:841)

@benvinegar
Copy link
Contributor

@qbig – I notice this is when running on Android. Do you get the same exception from the iOS simulator / iOS devices?

@benvinegar benvinegar reopened this Jan 14, 2016
@benvinegar
Copy link
Contributor

@qbig – any news on this?

@qbig
Copy link
Contributor Author

qbig commented Jan 21, 2016

@benvinegar I have tried on iOS simulator. It wasn't throwing the same exception. But I wasn't getting any events either. ok. I could get event now. Would try on android again. Let you know how it goes.

With RN0.18, it's not crashing anymore. So maybe can close this issue

@qbig
Copy link
Contributor Author

qbig commented Jan 29, 2016

I was testing with Android emulator(Genymotion), and I have limit the length of the stacktrace to 1000 characters. But it only works on dev Mode. Once I build it to a release version apk, JS error would simply crash the App and no msg would be logged to Sentry.

    ErrorUtils.setGlobalHandler(function(){
      var error = arguments[0];
      defaultHandler.apply(this, arguments)
      console.log(JSON.stringify(error));
      error.stack = error.stack.substring(0,1000);
      Raven.captureException(error);
    });

I suspect this is caused by the different behaviours of defaultHandler.apply(this, arguments) in dev and prod mode and the app crashed before any stacktrace was sent to Sentry

@nevir
Copy link
Contributor

nevir commented Feb 24, 2016

React Native's default behavior (on iOS) for global exceptions is to re-throw the exception in Obj-C land, causing an immediate crash (and no chance for Raven to upload the exception)

@benvinegar
Copy link
Contributor

Sentry now has a first-class React Native plugin that combines both JavaScript and native (iOS) frames in stack traces.

Closing this issue.

@nevir
Copy link
Contributor

nevir commented Mar 23, 2017 via email

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.

3 participants