-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find error code line in crashlytics #1783
Comments
No way so far for me to upload the source maps and see the line of code. On the other hand, following this thread in the app.js: //Define an error handler to upload thet stack to crashlytics
const defaultHandler = global.ErrorUtils.getGlobalHandler()
const crashlytics = firebase.crashlytics()
global.ErrorUtils.setGlobalHandler((...args) => {
const error = args[0] || 'Unknown'
//console.log('Crashlytics error sent', error);
if (error instanceof Error) {
crashlytics.setStringValue('stack', `${error.stack}`)
crashlytics.setStringValue('message', `${error.message}`)
crashlytics.recordError(0, `RN Fatal: ${error.message}`)
} else {
// Have never gotten this log so far. Might not be necessary.
crashlytics.recordError(0, `RN Fatal: ${error}`)
}
crashlytics.log(error.message);
defaultHandler.apply(this, args);
//force the native crash
crashlytics.crash();
}); So on my Crashlytics console I can see something like: -[RNFirebaseCrashlytics log:] line 26 $ TypeError: undefined is not an object (evaluating '_styles.default.fakeOne.fakeProp')
This error is located at:
in About (created by Connect(About))
in Connect(About) (at screenWrapper.js:52)
in RCTView (at View.js:45)
in ErrorMessageProvider (at screenWrapper.js:69)
in Provider (at screenWrapper.js:68)
in ScreenWrapper (at Navigation.js:51)
in _class (at renderApplication.js:34)
in RCTView (at View.js:45)
in RCTView (at View.js:45)
in AppContainer (at renderApplication.js:33) Consider to move to Sentry, that allows you to upload the source maps and shows you the actual javascript line of code that generated the error. |
can you pls explain where i need to place below code. const defaultHandler = global.ErrorUtils.getGlobalHandler() global.ErrorUtils.setGlobalHandler((...args) => { if (error instanceof Error) { defaultHandler.apply(this, args); my index.js is console.disableYellowBox = true; import { Navigation } from "react-native-navigation"; Navigation.events().registerAppLaunchedListener(() => { |
You can add it after your last 'import' statement. I also found this tutorial to upload all the RN logs. |
@StefanoCremona
|
Your file could be like this: import { Navigation } from "react-native-navigation";
import { registerScreens } from "./src/config/routes";
import { addListeners } from "./src/utilities/listeners";
import { Provider } from "react-redux";
import setup from "./src/store/setup";
import { iconsMap, iconsLoaded } from "./src/utilities/AppIcons";
//**************** Update starts here ****************
import firebase from 'react-native-firebase';
//Define an error handler to upload thet stack to crashlytics
const defaultHandler = global.ErrorUtils.getGlobalHandler()
const crashlytics = firebase.crashlytics()
global.ErrorUtils.setGlobalHandler((...args) => {
const error = args[0] || 'Unknown'
//console.log('Crashlytics error sent', error);
if (error instanceof Error) {
crashlytics.setStringValue('stack', `${error.stack}`)
crashlytics.setStringValue('message', `${error.message}`)
crashlytics.recordError(0, `RN Fatal: ${error.message}`)
} else {
// Have never gotten this log so far. Might not be necessary.
crashlytics.recordError(0, `RN Fatal: ${error}`)
}
crashlytics.log(error.message);
defaultHandler.apply(this, args);
//force the native crash
crashlytics.crash();
});
//**************** Update ends here ****************
Navigation.events().registerAppLaunchedListener(() => {
const store = setup();
registerScreens(store, Provider);
addListeners();
}); |
Thank you |
I believe you can use |
FYI; upcoming v6.0.0 will capture JavaScript stack traces by default. |
You have to trigger a React Native error, like for example, as you press a button: console.log('Force an error: ', this.fakeObj.fakeProp); |
Hello 👋, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions. |
[crashlytics] Fixes: #1643, #1848, #1964, #1920, #1884, #1783, #1966, #1940, #1447 Features/Bugs Todo: Capture JS Exceptions with stack traces automatically Capture Unhandled Promise Rejections with stack traces automatically [Android] .crash() not captured in debug due to RN RedBox; see #1921 Support advanced user identifier features [Android] Enable Crashlyics NDK reporting by default (gist) Support toggling native crash logging off/on (e.g. disable in DEV) Support toggling JS crash logging off/on (e.g. disable in DEV) [ios] Static framework support for all modules [ios] Implement CocoaPods Firebase RN modules auto-loader script Implement firebase.json config loader; Android & iOS [tests] Fix false positive tests that catch errors (tests did not check that errors actually threw) [android] Cleanup manifest permissions for all modules [android] Implement Content provider base class [android] Investigate/fix issue where setDataCollectionDefaultEnabled is false by default in Firebase - it disables Crashlytics reporting
Hey all, Crashlytics has recently had a major overhaul in #1958 - this will land as part of v6. As this issue no longer applies (JS stack traces/Errors instances now captured by default, incl. unhandled promise rejections) I will close and lock this issue. [The full changelog can be viewed here] If you have any feedback/queries relating to the PR above please ask in the Thanks for reporting and thanks for your patience 💛 Loving
|
…rtase#1958) [crashlytics] Fixes: invertase#1643, invertase#1848, invertase#1964, invertase#1920, invertase#1884, invertase#1783, invertase#1966, invertase#1940, invertase#1447 Features/Bugs Todo: Capture JS Exceptions with stack traces automatically Capture Unhandled Promise Rejections with stack traces automatically [Android] .crash() not captured in debug due to RN RedBox; see invertase#1921 Support advanced user identifier features [Android] Enable Crashlyics NDK reporting by default (gist) Support toggling native crash logging off/on (e.g. disable in DEV) Support toggling JS crash logging off/on (e.g. disable in DEV) [ios] Static framework support for all modules [ios] Implement CocoaPods Firebase RN modules auto-loader script Implement firebase.json config loader; Android & iOS [tests] Fix false positive tests that catch errors (tests did not check that errors actually threw) [android] Cleanup manifest permissions for all modules [android] Implement Content provider base class [android] Investigate/fix issue where setDataCollectionDefaultEnabled is false by default in Firebase - it disables Crashlytics reporting
I'm still not seeing javascript stack traces being logged by default after implementing v6.2 running on iOS simulator & RN 61.5 |
Also not working for me... Tagging @Salakar for comments. Considering there are 7 thumbs up, which I assume are 7 people including me not being able to get javascript stack trace logged by default. Also, from https://invertase.io/blog/firebase-crashlytics-for-react-native?utm_source=github&utm_medium=changelog, there is this statement Is there anyone that actually is able to get this working? |
I have the same problem!!!! |
Yes, i have the exact same problem. My app crashed on a error thrown from a reducer in Redux and yet there is no JS stack trace showing. |
Same here, no JS stack trace, I'm using
|
Same here i'm not seeing any JS stack trace. |
Edit: opened a separate issue. |
@nokite actual open source developers have the decency not to spam issues with complaints. You posted about the indecency of the error reports twice but I don't recall you proposing a decent PR? |
Sorry if I came across this way, I really didn't mean it in a negative way! I appreciate all the effort put into this. |
…rtase#1958) [crashlytics] Fixes: invertase#1643, invertase#1848, invertase#1964, invertase#1920, invertase#1884, invertase#1783, invertase#1966, invertase#1940, invertase#1447 Features/Bugs Todo: Capture JS Exceptions with stack traces automatically Capture Unhandled Promise Rejections with stack traces automatically [Android] .crash() not captured in debug due to RN RedBox; see invertase#1921 Support advanced user identifier features [Android] Enable Crashlyics NDK reporting by default (gist) Support toggling native crash logging off/on (e.g. disable in DEV) Support toggling JS crash logging off/on (e.g. disable in DEV) [ios] Static framework support for all modules [ios] Implement CocoaPods Firebase RN modules auto-loader script Implement firebase.json config loader; Android & iOS [tests] Fix false positive tests that catch errors (tests did not check that errors actually threw) [android] Cleanup manifest permissions for all modules [android] Implement Content provider base class [android] Investigate/fix issue where setDataCollectionDefaultEnabled is false by default in Firebase - it disables Crashlytics reporting
i can't see js line error RN : 63.4 |
…rtase#1958) [crashlytics] Fixes: invertase#1643, invertase#1848, invertase#1964, invertase#1920, invertase#1884, invertase#1783, invertase#1966, invertase#1940, invertase#1447 Features/Bugs Todo: Capture JS Exceptions with stack traces automatically Capture Unhandled Promise Rejections with stack traces automatically [Android] .crash() not captured in debug due to RN RedBox; see invertase#1921 Support advanced user identifier features [Android] Enable Crashlyics NDK reporting by default (gist) Support toggling native crash logging off/on (e.g. disable in DEV) Support toggling JS crash logging off/on (e.g. disable in DEV) [ios] Static framework support for all modules [ios] Implement CocoaPods Firebase RN modules auto-loader script Implement firebase.json config loader; Android & iOS [tests] Fix false positive tests that catch errors (tests did not check that errors actually threw) [android] Cleanup manifest permissions for all modules [android] Implement Content provider base class [android] Investigate/fix issue where setDataCollectionDefaultEnabled is false by default in Firebase - it disables Crashlytics reporting
…rtase#1958) [crashlytics] Fixes: invertase#1643, invertase#1848, invertase#1964, invertase#1920, invertase#1884, invertase#1783, invertase#1966, invertase#1940, invertase#1447 Features/Bugs Todo: Capture JS Exceptions with stack traces automatically Capture Unhandled Promise Rejections with stack traces automatically [Android] .crash() not captured in debug due to RN RedBox; see invertase#1921 Support advanced user identifier features [Android] Enable Crashlyics NDK reporting by default (gist) Support toggling native crash logging off/on (e.g. disable in DEV) Support toggling JS crash logging off/on (e.g. disable in DEV) [ios] Static framework support for all modules [ios] Implement CocoaPods Firebase RN modules auto-loader script Implement firebase.json config loader; Android & iOS [tests] Fix false positive tests that catch errors (tests did not check that errors actually threw) [android] Cleanup manifest permissions for all modules [android] Implement Content provider base class [android] Investigate/fix issue where setDataCollectionDefaultEnabled is false by default in Firebase - it disables Crashlytics reporting
I've tested the crashlytics by adding an error Javascript's code. The iOS crash was reported in Firebase console like below:
How can I detect which file (or Javascript's code line) that cause the crash?
The text was updated successfully, but these errors were encountered: