react-native-fabric-crashlytics: Can't interpret line numbers with sourcemap.
When I use this component, I get a log file in Crashlytics that looks something like this:
Non-fatal Exception: Can't find variable: foobar
0 ??? 0x0 onPress (main.jsbundle:9477)
1 ??? 0x0 _onPress (main.jsbundle:9125)
2 ??? 0x0 a (main.jsbundle:1653)
3 ??? 0x0 o (main.jsbundle:1605)
When I use sourcemap using the script given here, and using line number 9477 and column 1, I get this output:
{ source: null, line: null, column: null, name: null }
There are only 608 lines in my main.jsbundle. How to interpret the output I’m seeing on crashlytics?
Thanks
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 33 (7 by maintainers)
Commits related to this issue
- fix a bug where numbers are reported as pointer value. see https://github.com/mikelambert/react-native-fabric-crashlytics/issues/1 — committed to jondot/react-native-fabric by jondot 8 years ago
- addressing https://github.com/mikelambert/react-native-fabric-crashlytics/issues/1 — committed to jondot/react-native-fabric-crashlytics by jondot 8 years ago
- Add option to bundle server to generate full sourcemaps from babel Reviewed By: bestander Differential Revision: D3863894 fbshipit-source-id: a282758e022d403743841bc59277196e6741ed18 — committed to facebook/react-native by cwdick 8 years ago
- addressing https://github.com/mikelambert/react-native-fabric-crashlytics/issues/1 — committed to arronmabrey/react-native-fabric-crashlytics by jondot 8 years ago
- fix a bug where numbers are reported as pointer value. see https://github.com/mikelambert/react-native-fabric-crashlytics/issues/1 — committed to Abel8874/react_native_fabric_lib by jondot 8 years ago
- fix a bug where numbers are reported as pointer value. see https://github.com/mikelambert/react-native-fabric-crashlytics/issues/1 — committed to Raul221/react_native_fabric_lib by jondot 8 years ago
- fix a bug where numbers are reported as pointer value. see https://github.com/mikelambert/react-native-fabric-crashlytics/issues/1 — committed to Leone112/ReactNative_FabricLib by jondot 8 years ago
@mikelambert When would merge the pr?
So I’m now after a full project setup with how I think this can work, and it works great. Building the sourcemap is done in a similar way to a bundle, so I guess this is a command a user would need to run (I hacked the default react-native runner - but I think we can drive the fact that the build will always generate source maps to the core react native repo with a PR, aside from little more CPU i don’t see why not)
So here’s how you engage with the new API:
Unfortunately, anyone wanting to read a bundled source map has only one way to do that - with RNFS. Previous React Native releases had already read sourcemaps and had sourcemap exposed as a magic global variable but right now a React Native process comes up blank. It was made so in order to save memory - so we might need to warn users that using sourcemaps isn’t for free.
Back to the code sample, here,
inittakes sourcemap. This is adjusted to @mikelambert comment about usinginitwith or without sourcemap, I haven’t yet did that - but we can make it not load and use sourcemap when the argument isn’t given.sourcemap.jsis built the same waymain.jsbundleis built, and resides in the main app the same way for it to be packaged (and read later):And to sum it up, this uses the patch to this library and the
react-native-fabricfork with the fixed type conversion bug.Next up I’m going to submit a PR tomorrow (since I need to use this time right now for something else), and that will include the
initwhich knows how to toggle modes. With that, and the snippet above that we can put in the README.md, we have a working solution.Hey guys, I’ve been working on this problem, and after pulling most of my hair out, finally have a solution. Sadly, I can now say that none of the above will really work, because there are a few fundamental bugs in how this library interprets positions, and how Crashlytics accepts data (might be on their side).
The fix is a combination of pulling sourcemaps, tweaking this library and the native crashlytics reporting as well. I need some time to pick up the pieces and make an elegant patch and for now, stay tuned 😃.