Skip to content

sourceURL in raw React Native stack frames is inconsitent #665

@jbroma

Description

@jbroma

Description

Adding bridgeless support introduced few regressions in terms of sourceURL (passed to evaluateJavascript from jsi/jsi.h) - this argument is used to tell the JS engine where the evaluated code comes from.

  1. Native module - iOS:
  • sourceUrl passed to evaluateJavascript in executeFromFilesystem from packages/repack/ios/ScriptManager.mm is incorrect -> we should use url from the ScriptConfig
  1. Native module - Android:
  • sourceUrl passed to evaluate in execute from packages/repack/android/src/main/java/com/callstack/repack/RemoteScriptLoader.kt is incorrect -> we should use url from the ScriptConfig
  1. Possible inconsitentencies on Android:
  • sourceUrl passed to evaluate in execute from packages/repack/android/src/main/java/com/callstack/repack/FileSystemScriptLoader.kt is inconsistent with iOS - depending on config.absolute we pass different values -> to align with iOS we should most likely use config.url in both cases

At this point it's hard to tell what should be passed in both cases - passing sourceUrl starting with http:// makes sense in development and the whole symbolication flow is centred around that , but does it make sense in production when evaluating remote bundles?

Thoughts on the matter

  • we should consider passing just the name of the bundle (enhanced with uniqueName if needed - like in a super app setup) to match the source-map nicely - (this could be altered with config.absolute)
  • we need to ensure that when something is loaded from cache ends up with the same name - TBD whether this is the case
  • we need to ensure that local chunks also follow the same convention - the location only matters for the resolver and not the source-maps
  • there is a chance that solving this could enable sentry to work with multiple source-maps out of the box, since there is no official support for that but Sentry allows uploading multiple files.

Reproducible Demo

  • can be reproduced in TesterApp by printing out the filenames from stack frames in process method from packages/dev-server/src/plugins/symbolicate/Symbolicator.ts. Note: filesystem loading flow can only be observed in release

Additional notes

sourceURL is used when creating an error stack frame in React Native. When you want to symbolicate a stack trace, you lookup the source through sourceURL and then from the source file you can obtain the name of the source map, from the comment at the very bottom (added through SourceMapDevToolPlugin):

...
//# sourceMappingURL=src_asyncChunks_Async_local_tsx.chunk.bundle.map?platform=ios

Metadata

Metadata

Assignees

Labels

area:nativeThe issue involves the native module of Re.Packarea:repackThe issue is about logic/code inside of Re.Pack.type:bugA bug report.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions