Skip to content
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

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

Open
michaelmurad opened this issue May 21, 2020 · 7 comments

Comments

@michaelmurad
Copy link

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.

@waltjones
Copy link
Contributor

@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.

@koloszko
Copy link

koloszko commented Nov 8, 2020

@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

@waltjones
Copy link
Contributor

@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.

@sdandois
Copy link

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

@waltjones
Copy link
Contributor

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.

@taltrui
Copy link

taltrui commented Oct 26, 2021

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

@rarenatoe
Copy link

@waltjones it didn't work for me.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants