rollbar-react-native icon indicating copy to clipboard operation
rollbar-react-native copied to clipboard

Enabling Hermes changes Minified JS URL to //reactnativehost/address at index.android.bundle

Open michaelmurad opened this issue 5 years ago • 7 comments

Screen Shot 2020-05-21 at 3 39 26 PM

Prior to enabling Hermes on Android the Minified JS URL would be //reactnativehost/index.android.bundle.

After enabling Hermes it is now //reactnativehost/address at index.android.bundle

Is there any known way to fix this and get it back to index.android.bundle?

Thanks so much for the awesome work and for your time.

michaelmurad avatar May 21 '20 22:05 michaelmurad

@michaelmurad You can add a custom rewrite pattern in your config. See the React Native section here: https://docs.rollbar.com/docs/source-maps#react-native

New patterns can be added to the default list in later releases of rollbar-react-native, but adding it to your config will allow you to get it working without the wait.

waltjones avatar May 21 '20 22:05 waltjones

@waltjones But is it just a matter of adding a custom rewrite pattern in config? As I can see there is difference in stacktrace format in JSON sent to rollbar when Hermes is enabled. When Hermes is disabled then the value of notifier.diagnostic.raw_error.stack I see in occurrence raw JSON is:

"index.android.bundle:397:3243\[email protected]:108:423\nindex.android.bundle:108:1724\[email protected]:108:423\[email protected]:108:900\nindex.android.bundle:108:1043\[email protected]:124:155\nindex.android.bundle:124:882\[email protected]:129:656\[email protected]:129:1020\[email protected]:129:3085\ncallImmediates@[native code]\[email protected]:27:3107\nindex.android.bundle:27:1283\[email protected]:27:2799\[email protected]:27:1253\nvalue@[native code]\nvalue@[native code]"

But when Hermes is enabled then it looks like that:

"TypeError: Network request failed\n at anonymous (address at index.android.bundle:1:173131)\n at call (native)\n at dispatchEvent (address at index.android.bundle:1:202568)\n at value (address at index.android.bundle:1:194209)\n at value (address at index.android.bundle:1:192426)\n at apply (native)\n at anonymous (address at index.android.bundle:1:193822)\n at apply (native)\n at value (address at index.android.bundle:1:55797)\n at apply (native)\n at value (address at index.android.bundle:1:50949)\n at anonymous (address at index.android.bundle:1:49484)\n at value (address at index.android.bundle:1:50548)\n at value (address at index.android.bundle:1:49442)"

So it seems that stacktrace format is different when Hermes is enabled and I am not sure if rollbar do well in that case

koloszko avatar Nov 08 '20 19:11 koloszko

@koloszko The rewrite pattern is applied to each path in the stack after the raw stack string is parsed. The parser for the stack strings is pretty good at handling different formats, though I don't know what it produces for your example. Unless it fails to parse at all, a custom rewrite pattern is still probably the best solution.

The value at notifier.diagnostic.raw_error.stack is used to diagnose issues when the parser fails. Is it not the what the rewrite pattern gets applied to. The rewrite pattern is applied to each path string in the parsed stack.

waltjones avatar Nov 12 '20 13:11 waltjones

Can someone share the rewrite pattern you are using? Thanks.

sdandois avatar Oct 26 '21 17:10 sdandois

For the format in the original report ('//reactnativehost/address at index.android.bundle'), this should work:

'^address at (.*)$'

If your URLs are different, or if that pattern doesn't work for you, let me know what your URLs look like.

waltjones avatar Oct 26 '21 18:10 waltjones

Hi @waltjones thanks for your help! I was able to make it work with that regex.

taltrui avatar Oct 26 '21 20:10 taltrui

@waltjones it didn't work for me.

My address looks like this: http://reactnativehost/address at index.android.bundle:1

rarenatoe avatar Nov 14 '23 17:11 rarenatoe