getsentry / symbolicator

Native Symbolication as a Service
https://getsentry.github.io/symbolicator/
MIT License
358 stars 47 forks source link

[RN] Use `react_native_context.hermes_debug_info` #1448

Open krystofwoldrich opened 5 months ago

krystofwoldrich commented 5 months ago

React Native Hermes events contain information about the runtime bundle which can be used to return from the symbolication process early and inform user about the incorrect source map type.

Depending on the way RN application with Hermes was build the Hermes bundle can contain debug information, this mean the engine will emit JS frames which can be symbolicated by packager JS source map.

If Hermes bundle doesn't contain debug information Hermes source map is needed.

contexts.react_native_context.hermes_debug_info=boolean is true when the runtime bundle contained the debug information otherwise false and not present if the event is from RN without Hermes.

Pseudocode:

if (source_map.type == 'hermes' && event.contexts.react_native_context.hermes_debug_info == true) {
    throw 'packager source map is needed' 🚨
} else {
    // JSC or Hermes with debug info and packager source map ✅
    symbolicate()
}