Open michaelmurad opened 4 years ago
@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 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.rawerror.stack I see in occurrence raw JSON is:
"index.android.bundle:397:3243\np@index.android.bundle:108:423\nindex.android.bundle:108:1724\np@index.android.bundle:108:423\no@index.android.bundle:108:900\nindex.android.bundle:108:1043\nf@index.android.bundle:124:155\nindex.android.bundle:124:882\nx@index.android.bundle:129:656\ny@index.android.bundle:129:1020\ncallImmediates@index.android.bundle:129:3085\ncallImmediates@[native code]\nvalue@index.android.bundle:27:3107\nindex.android.bundle:27:1283\nvalue@index.android.bundle:27:2799\nvalue@index.android.bundle: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 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.
Can someone share the rewrite pattern you are using? Thanks.
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.
Hi @waltjones thanks for your help! I was able to make it work with that regex.
@waltjones it didn't work for me.
My address looks like this: http://reactnativehost/address at index.android.bundle:1
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.