Reputation: 4279
In my application I'm experiencing a weird error with Bugsnag which I cannot reproduce but I see a lot in production.
I have a React-Native application with Native Modules.
In my Applciation.oncreate
first thing I do is to call Bugsnag.start
.
I also call Bugsnag.start
in index.js
.
In my Native Module's constructor I call for a method the eventually calls for Bugsnag.notify
this results in an error
You must call Bugsnag.start before any other Bugsnag methods.
Here's the stack trace of the crash:
java.lang.IllegalStateException: You must call Bugsnag.start before any other Bugsnag methods
at com.bugsnag.android.Bugsnag.getClient(Bugsnag.java:480)
at com.bugsnag.android.Bugsnag.notify(Bugsnag:228)
at com.yg.the.XXXXXX.utils.Logger.logger(Logger.java:56)
at com.yg.the.XXXXXX.XXXXXXXReactNativeModule.<init>(XXXXXXXXReactNativeModule.java:116)
at com.yg.the.xxxxxxx.xxxxxxxReactNativePackage.createNativeModules(XXXXXXXReactNativePackage:17)
at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42)
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:42)
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1456)
at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1427)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1338)
at com.facebook.react.ReactInstanceManager.access$1200(ReactInstanceManager:136)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1108)
at java.lang.Thread.run(Thread.java:919)
Since it's Native Module, it's initialized on a different thread but as far as I know Native Modules are initialized after Application.onCreate
finished its execution. So I don't think this a race condition issue.
Besides, when looking at this error on Bugsnag console - in Breadcrumbs section I see a message stating - Bugsnag loaded and then Error occurred.
How can it be then, if it's possible that it's loaded but throws an error saying it's not started?
Upvotes: 2
Views: 662