Can't interpret line numbers with sourcemap.
See original GitHub issueWhen 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
Issue Analytics
- State:
- Created 7 years ago
- Comments:33 (7 by maintainers)
Top Results From Across the Web
Error Overlay Shows Un-Source-Mapped Lines #226 - GitHub
But in my console I can see the correct (ie. source-mapped) line numbers: useAddFoo.js?fda8:23 Uncaught (in promise) TypeError: Cannot read property 'id' of ......
Read more >How can I get the original line number and symbol from a ...
I'm logging javascript errors from my site, but the files are minimized so I don't get meaningful line numbers. I do have source...
Read more >4 Reasons Why Your Source Maps are Broken - Sentry Blog
This likely means that your source map doesn't contain or link to your original source files. Without your original source files, you're still ......
Read more >Debugging JavaScript with Source Maps - Rollbar
Minified JavaScript code generates source maps that can help trace and debug problems back to the exact line of source code.
Read more >Yet another explanation on sourcemap | by NGUYEN Trung
Some systems interpret special character differently (for example line ending character 10 ). Base64 was originally invented to solve these ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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,
init
takes sourcemap. This is adjusted to @mikelambert comment about usinginit
with 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.js
is built the same waymain.jsbundle
is 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-fabric
fork 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
init
which knows how to toggle modes. With that, and the snippet above that we can put in the README.md, we have a working solution.