Skip to content

App crash with react native integration #468

Closed

Description

@qbig

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://xxx@app.getsentry.com/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)

Activity

  1. added a commit that references this issue on Jan 12, 2016
    1c40c7d
  2. qbig commented on Jan 14, 2016

    @qbig
    ContributorAuthor

    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)
    
  3. benvinegar commented on Jan 14, 2016

    @benvinegar
    Contributor

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

  4. benvinegar commented on Jan 18, 2016

    @benvinegar
    Contributor

    @qbig – any news on this?

  5. qbig commented on Jan 21, 2016

    @qbig
    ContributorAuthor

    @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

  6. qbig commented on Jan 29, 2016

    @qbig
    ContributorAuthor

    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

  7. nevir commented on Feb 24, 2016

    @nevir
    Contributor

    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)

  8. benvinegar commented on Mar 23, 2017

    @benvinegar
    Contributor

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

    Closing this issue.

  9. nevir commented on Mar 23, 2017

    @nevir
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions