React-Native crashes not being captured by raygun
zacharyweidenbach opened this issue · comments
react-native: v0.59.10
react-navigation: v3.3.2
raygun4js: v1.14.1
async componentDidMount() {
raygun('enableCrashReporting', true);
raygun('disableErrorTracking', false);
raygun('apiKey', config.raygun && config.raygun.apiKey);
raygun('setVersion', `${VersionNumber.appVersion}-${VersionNumber.buildVersion}`);
let airplaneModeEnabled = null;
const batteryLevel = await DeviceInfo.getBatteryLevel();
try {
// throws when remote debugger is open
// https://github.com/rebeccahughes/react-native-device-info#isairplanemode
airplaneModeEnabled = await DeviceInfo.isAirPlaneMode();
} catch (e) {
console.warn(e);
}
const deviceInfo = {
androidApiLevel: DeviceInfo.getAPILevel(),
brand: DeviceInfo.getBrand(),
deviceId: DeviceInfo.getDeviceId(),
deviceLocale: DeviceInfo.getDeviceLocale(),
deviceManufacturer: DeviceInfo.getManufacturer(),
maxMemory: DeviceInfo.getMaxMemory(),
totalMemory: DeviceInfo.getTotalMemory(),
deviceModel: DeviceInfo.getModel(),
systemVersion: DeviceInfo.getSystemVersion(),
batteryLevel,
airplaneModeEnabled,
env,
};
raygun('withCustomData', { deviceInfo });
raygun('boot'); // This call must be made last to start the provider
}
Crash reporting was previously working correctly, but possible stopped working after upgrading from React Native 0.59.5 to 0.59.10 for both iOS and Android.
I have confirmed that errors are being sent when manually triggered with
raygun('send', new Error('Test Error'));
I have also tried upgrading to the latest version of raygun4js v1.71.1
but get the same result.
After some further investigation, crashes that are thrown in the initial screen of react-navigation's navigation stack are captured by raygun. But if I navigate to any other screen and a crash occurs, raygun seems to miss the crash entirely.
Edit*
After downgrading react-native back to 0.59.5, this issue is still occurring.
Hi Zachary,
I'm not sure what changed here since you say downgrading back to 0.59.5, which you said previously worked, doesn't work. I suspect something is happening with React Native triggering window.onerror
, would you be able to try out a library like this https://github.com/master-atul/react-native-exception-handler to see if it gets notified about the errors more reliably?
Taylor
I have tried the react-native-exception-handler
library as advised, and I am getting inconsistent behavior still. The JS exception handler used in that library only seems to capture the errors thrown on certain screens in the tab navigator, whereas errors in the other tabs are undefined
and isFatal
is undefined
as well. Console warning errors are undefined as well, so I lose even more detail using this library it seems.
At this point in time, with no other fix possible, it looks like I'll need to turn to a different library/service for error reporting.
Closing this issue as raygun4reactnative is now the recommended solution for React Native crash reporting.