Sentry-cli: Support react-native ram-bundle

Created on 4 Oct 2018  路  11Comments  路  Source: getsentry/sentry-cli

React Native supports a binary bundle format to avoid having to load the whole js bundle in memory initially. Doc here: https://facebook.github.io/react-native/docs/performance#ram-bundles-inline-requires.

It would be nice if sentry would support this. The packager still generates a source-map and I was able to get it to upload by changing https://github.com/getsentry/sentry-cli/blob/master/src/commands/react_native_xcode.rs#L253 to if args.len() > 1 && (args[1] == "bundle" || args[1] == "ram-bundle") { but sentry doesn't seem to be able to understand it.

According to the metro team it builds a "sectioned sourcemap" but I'm not sure what that is. I can put you in contact with someone on the metro team if that can help.

Here's an example of the source map and bundle uploaded https://sentry.io/th3rdwave/th3rdwave-app/releases/ANF.Th3rdWave-3.1.0/artifacts/

Most helpful comment

You should be able to use it like this:

Run: yarn react-native-symbolicate bundle.map 42 13

Where:

  • bundle.map is the sourcemap
  • 42: line number
  • 13: column (optional)

The tests in that package should give you more of an idea on how to use it. Let me know if you need any more help.

All 11 comments

It'd be useful to understand how this evaluates on sourcemaps.io (which is a tool/validator we built). Also if you're able (I think GitHub allows it), uploading an example artifact here would be super helpful for future reference. If its sensitive we can address it when we are able to commit to providing support.

The RN team recently open sourced their symbolication package for ram-bundles https://github.com/facebook/react-native/tree/master/packages/react-native-symbolicate that can probably help. @dcramer I'll look into providing the info you mentioned.

Maybe @cpojer or someone from the metro team can chip in on how this work internally for facebook.

You should be able to use it like this:

Run: yarn react-native-symbolicate bundle.map 42 13

Where:

  • bundle.map is the sourcemap
  • 42: line number
  • 13: column (optional)

The tests in that package should give you more of an idea on how to use it. Let me know if you need any more help.

@cpojer this does not work with sectioned/indexed sourcemaps (i.e. yarn react-native-symbolicate bundle.map 321.js 1 675). Please check the PR which attempts to fix it: https://github.com/facebook/react-native/pull/23514

I published a new release of react-native-symbolicate (0.0.3) with the fixes by @mbardauskas. Let me know if you need any more help from me :)

Hi. Is there a plan to include this in an upcoming release?

We will have a look at it. I was not quite able to determine what is actually missing here to support it on our side. We have been supporting indexed sourcemaps for many years now and I was under the understanding that sectioned sourcemap is just another term for an indexed sourcemap.

Nevermind I see now, facebook has some proprietary extensions for sourcemaps. I will have a look at what options we have here to implement this.

We implemented ram bundle support the underlying rust library now. The plan is to automatically unbundle RAM bundles before sourcemap upload as part of sentry-cli. This effort is taking place in the PR #523

The server does not require changes for this which means that once that lands, ram bundle support will also work for open source installations of sentry without upgrades. Just requires a new sentry-cli version.

Initial support for indexed RAM Bundles (aka "iOS bundles") was added in version 1.42.0.

sentry-cli should detect them automatically based on extension (".jsbundle/.bundle" both work) and the magic header indexed RAM bundles have. Additionally, sentry-cli needs to have access to the corresponding sourcemap.

@tonyo Nice work, I just tested this and it works perfectly after updating the sentry version.

Was this page helpful?
0 / 5 - 0 ratings