Open dusanristic opened 1 week ago
Hi @dusanristic, thank you for the message,
from the Sentry.init
I see that you have set autoInitializeNativeSdk: false
which means you initialize the platform SDK manually.
For Session Replay to work in RN, it has to be enabled in the platform SDK as well.
Please add the replay sample rates to iOS and Android inits.
Hey @krystofwoldrich, I do have these params on native side as well (apologise for not adding them in the first place). Below is the snippet code for iOS in AppDelegate.mm
file:
[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
options.dsn = @"https://63b8941d39cb0367e993da924c5f21e1@o4506870128181248.ingest.us.sentry.io/4506904420286464";
options.debug = true;
options.tracesSampleRate = [NSNumber numberWithDouble:1.0];
options.profilesSampleRate = [NSNumber numberWithDouble:1.0];
// Load values from Info.plist as dictionary
NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
// Extract version and dist from dictonary
NSString* version = [infoDict objectForKey:@"CFBundleShortVersionString"];
NSString* dist = [infoDict objectForKey:@"CFBundleVersion"];
options.releaseName = [NSString stringWithFormat:@"%@%@", @"XXXXXXX@", version];
options.dist = dist;
options.environment = [infoDict objectForKey:@"logger_environment"];
}];
@dusanristic No worries, thank you for sharing the iOS init.
For Session replay to work, you need to add the following to your iOS init.
options.experimental.sessionReplay.onErrorSampleRate = 1.0
options.experimental.sessionReplay.sessionSampleRate = 1.0
Let us know if this fixed the issue.
Thanks for your help and fast response! I have one more question though.
When I add the mentioned lines to iOS init, I get the following error:
Property 'sessionReplay' cannot be found in forward class object 'SentryExperimentalOptions'.
Is there anything else I need to do to enable experimental features on iOS? I went through the documentation, and the only thing I found is that I need to have at least Sentry Cocoa SDK v8.31.1, but my Sentry pod version is already v8.37.0.
What React Native libraries do you use?
Hermes, React Navigation
Are you using sentry.io or on-premise?
sentry.io (SaS)
@sentry/react-native SDK Version
5.34.0
How does your development environment look like?
OS: Sonoma 14.1.1 Node: 18.7.1 yarn: 1.22.22 react-native: 0.72.7 hermesEnabled: true newArchEnabled: false
Sentry.init()
Steps to Reproduce
/
Expected Result
Because the
replaysSessionSampleRate
parameter is set to 1, I expect that every session is recorded and sent to Sentry. Additionally, when I dispatch an error, that replay is not logged to Sentry either.My Replay dashboard is empty.
Actual Result
Nothing is logged to Sentry, and my Replay session dashboard is empty. When I run the app, this is my output:
I am getting that MobileReplay is not sampled even though
replaysSessionSampleRate
is set to 1.