sentry-react-native
sentry-react-native copied to clipboard
Initialize native SDKs before JS
Available in https://github.com/getsentry/sentry-react-native/releases/tag/6.7.0-alpha.0
Create sentry.options.json in the React Native project root and set options the same as you currently have in Sentry.init in JS.
{
"dsn": "https://[email protected]/value",
}
Initialize Sentry on the native layers by newly provided native methods.
import io.sentry.react.RNSentrySDK
class MainApplication : Application(), ReactApplication {
override fun onCreate() {
super.onCreate()
RNSentrySDK.init(this)
}
}
#import <RNSentry/RNSentry.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[RNSentrySDK start];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
Development
Tasks
- [x] Create RNSentry.init for Android
- [x] Create RNSentry.init for Cocoa
- [ ] Update
@sentry/wizardto optionally usesentry.options.json - [ ] Add new manual init docs
- [ ] Add JSON file schema
- [ ] Add E2E tests using manual init
- [ ] Update Sample App to use manual init by default
Native RNSentry.init tasks
- [x] Drop JS Errors https://github.com/getsentry/sentry-react-native/blob/942161665edbac984baf81bc4e1ec289ebb0e58c/ios/RNSentry.mm#L127
- [x] Add event origin and environment https://github.com/getsentry/sentry-react-native/blob/942161665edbac984baf81bc4e1ec289ebb0e58c/ios/RNSentry.mm#L177
@krystofwoldrich customer is asking:
do you have any timeline/estimate around when this issue could be fixed?
@realkosty We don't have a timeline yet. But it's possible to capture the startup crashes when initializing the native SDKs manually. The How to set up for start up crashes at the moment part of the issue.