bugsnag / bugsnag-react-native

Error monitoring and reporting tool for native exceptions and JS errors in React Native apps
https://docs.bugsnag.com/platforms/react-native
MIT License
369 stars 121 forks source link

Unhandled crashes not sent. (iOS) #464

Closed cvvspb closed 4 years ago

cvvspb commented 4 years ago

Description

Issue

Crash logs are generated but not sent.

Environment

Library versions:

├─ bugsnag-react-native@2.23.9
├─ react-native-code-push@6.2.1
└─ react-native@0.62.2

Example Repo

Example code snippet

import { Client, Configuration } from 'bugsnag-react-native';
import getDefaultSettings from './settingsHelper';
import { version } from '../../../package.json';

const settings = getDefaultSettings();

const configuration = new Configuration();
configuration.apiKey = settings.bugsnagApiKey;
configuration.notifyReleaseStages = ['production', 'staging', 'development'];
configuration.releaseStage = settings.env;
configuration.codeBundleId = version;

configuration.registerBeforeSendCallback(report => {
    report.metadata = {
        ...(report.metaData || {}),
        reduxState: global.Store ? global.Store.getState() : null,
    };
    // eslint-disable-next-line no-undef
    if (__DEV__) {
        console.warn('bugsnag report suppressed', report);
        return false;
    }
    return true;
});

const Bugsnag = new Client(configuration);

export default Bugsnag;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// #if DEBUG && TARGET_OS_SIMULATOR
//   InitializeFlipper(application);
// #endif
  [BugsnagReactNative start];
  [AppCenterReactNative register]; // Initialize AppCenter
  [AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true]; // Initialize AppCenter analytics
  [GMSServices provideAPIKey:@"SOME_KEY"]; // Initialize Google maps
  [FIRApp configure];

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"MyAppName"
                                            initialProperties:nil];

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  [RNSplashScreen show];
  return YES;
}
Error messages:
2020-06-25 19:56:43.335610+0300 MyAppName[8314:3751160]  - <AppMeasurement>[I-ACS036002] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2020-06-25 19:56:43.366494+0300 MyAppName[8314:3750977] Attempted to override non-null API key with nil - ignoring.
2020-06-25 19:56:43.401666+0300 MyAppName[8314:3751171] 6.13.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60106000 started
2020-06-25 19:56:43.402588+0300 MyAppName[8314:3751171] 6.13.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2020-06-25 19:56:43.423631+0300 MyAppName[8314:3750977] 
[CodePush] Loading JS bundle from file:///private/var/containers/Bundle/Application/F45CAD0D-F8CD-467A-9A29-C0E217E5A09A/MyAppName.app/main.jsbundle
2020-06-25 19:56:43.753402+0300 MyAppName[8314:3750977] [] nehelper sent invalid result code [1] for Wi-Fi information request
2020-06-25 19:56:43.754569+0300 MyAppName[8314:3750977] [] nehelper sent invalid result code [1] for Wi-Fi information request
2020-06-25 19:56:43.755870+0300 MyAppName[8314:3750977] [] nehelper sent invalid result code [1] for Wi-Fi information request
2020-06-25 19:56:43.757291+0300 MyAppName[8314:3750977] [] nehelper sent invalid result code [1] for Wi-Fi information request
2020-06-25 19:56:43.802360+0300 MyAppName[8314:3751182] Sent 1 sessions to Bugsnag
2020-06-25 19:56:43.850 [info][tid:main][RNGestureHandlerManager.m:136] [GESTURE HANDLER] Initialize gesture handler for root view <RCTRootContentView: 0x106d1c1c0; reactTag: 1; frame = (0 0; 414 896); gestureRecognizers = <NSArray: 0x282296910>; layer = <CALayer: 0x282cff080>>
2020-06-25 19:56:43.880272+0300 MyAppName[8314:3750977] WF: === Starting WebFilter logging for process MyAppName
2020-06-25 19:56:43.880299+0300 MyAppName[8314:3750977] WF: _WebFilterIsActive returning: NO
2020-06-25 19:56:44.059228+0300 MyAppName[8314:3750977] [ProcessSuspension] 0x116da1680 - ProcessAssertion::processAssertionWasInvalidated()
2020-06-25 19:56:44.060770+0300 MyAppName[8314:3750977] [ProcessSuspension] 0x116da16e0 - ProcessAssertion::processAssertionWasInvalidated()
2020-06-25 19:56:45.027792+0300 MyAppName[8314:3750977] [react-native-permissions] ios.permission.CAMERA permission checked: granted
2020-06-25 19:56:45.030929+0300 MyAppName[8314:3750977] [react-native-permissions] ios.permission.LOCATION_WHEN_IN_USE permission checked: granted
INFO : BSG_KSCrash.m (286): -[BSG_KSCrash sendAllReportsWithCompletion:]: Sending 2 crash reports
2020-06-25 19:56:47.818565+0300 MyAppName[8314:3751182] 
[CodePush] Applying full update.
2020-06-25 19:57:13.952718+0300 MyAppName[8314:3750977] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
2020-06-25 19:57:13.953762+0300 MyAppName[8314:3750977] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service
2020-06-25 19:57:33.889552+0300 MyAppName[8314:3751186] [] tcp_input [C4.1:3] flags=[R] seq=1207297829, ack=0, win=0 state=LAST_ACK rcv_nxt=1207297829, snd_una=2396321532
2020-06-25 19:57:33.895918+0300 MyAppName[8314:3751186] [] tcp_input [C4.1:3] flags=[R] seq=1207297829, ack=0, win=0 state=CLOSED rcv_nxt=1207297829, snd_una=2396321532
2020-06-25 19:57:33.896213+0300 MyAppName[8314:3751186] [] tcp_input [C4.1:3] flags=[R] seq=1207297829, ack=0, win=0 state=CLOSED rcv_nxt=1207297829, snd_una=2396321532

So, Bugsnag says it's sending the reports, but I can't see them. Android is reporting just fine.

Don't know if it has anything to do with those com.apple.WebKit notifications (I'm not using the WebView, maybe GoogleMaps does) or tcp_input messages.

johnkiely1 commented 4 years ago

Hi @cvvspb

Could you confirm are you using a debugger? You should see something in the logs like this if you are :

WARN : BSG_KSCrashSentry.c (103): BSG_KSCrashType bsg_kscrashsentry_installWithContext(BSG_KSCrash_SentryContext , BSG_KSCrashType, void ()(void *)): KSCrash: App is running in a debugger. Only user reported events will be handled.

If you are, only handled exceptions will be sent which might explain the behaviour you are seeing.

According to a post here the WebKit errors suggest there may be intermittent network connection issues which could also explain why the reports are not sent. Is this something that could be happening while your application is running?

xljones commented 4 years ago

Closing out due to inactivity. Any further related comments to add, please do drop them in here and we'll re-open the issue.