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

Add Support RAM Bundle Format for Javascript Errors #140

Open
2 tasks done
leezumstein opened this issue Oct 13, 2020 · 1 comment
Open
2 tasks done

Add Support RAM Bundle Format for Javascript Errors #140

leezumstein opened this issue Oct 13, 2020 · 1 comment

Comments

@leezumstein
Copy link

Platforms:

  • Android
  • iOS

Versions:

rollbar-react-native version: 0.9.1
react-native version: 0.61.5 (not using expo)

Problem:

Running into an issue when trying to integrate the Rollbar SDK into our React Native application and found that the stack traces being captured didn't match what was coming from the application. We'd receive a system error stating Possible source map configuration error: line and column number combination not found in source map whenever the line numbers didn't match up.

After digging into the issue, found the problem to be we're leveraging the RAM Bundle format for both Android and iOS, which appears to generate a different bundle format that does not appear to be supported by Rollbar during upload. For iOS this generates an indexed RAM bundle, while on Android we're leveraging the multiple Files RAM bundle type.

An example stack trace from iOS is below. Notice how the filename at then end is linking to one of the indexed RAM bundle modules:
Screen Shot 2020-10-13 at 9 01 42 AM

(Notice how it's referencing the generated module file, instead of the deobfuscated file from source).

The example steps provided in the documentation don't have an example for generating the ram-bundle sourcemaps, only bundle (see here). When attempting to switch to generating a ram-bundle with sourcemaps, I received an error response from the curl upload command.

Steps to Reproduce:

  1. Generate the iOS ram-bundle with sourcemaps using the following command in the React Native project root:
    > npx react-native ram-bundle \
         --platform ios \
         --dev false \
         --reset-cache \
         --entry-file index.js \
         --bundle-output "./build/index.ios.bundle" \
         --assets-dest "./build" \
         --sourcemap-output "./index.ios.bundle.map" \
         --sourcemap-sources-root ./
  2. Upload the sourcemaps to Rollbar with the following command:
    > curl https://api.rollbar.com/api/1/sourcemap \
         -F access_token=<post_server_item token> \
         -F version=<app version>.ios \
         -F minified_url=http://reactnativehost/main.jsbundle \
         -F source_map=@build/index.ios.bundle.map \
         -F index.js=@build/index.ios.bundle
  3. Notice the response you receive from the curl command will be the following:
    {
      "err": 1,
      "message": "Error: Source map missing property 'mappings'"
    }
  • The configuration I was using when instantiating a new client in the project is below:
    import { Platform } from 'react-native'
    import { Client, Configuration } from 'rollbar-react-native'
    
    const config = new Configuration('<post_client_item token>', {
      appVersion: '<app version>',
      environment: 'production',
      captureUncaught: true,
      captureUnhandledRejections: true,
      payload: {
        client: {
          javascript: {
            source_map_enabled: true,
            code_version: `<app version>.${Platform.OS}`,
          },
        },
      },
    })
    const client = new Client(config)
@netshade
Copy link

netshade commented Apr 2, 2021

We also are users of ram-bundle, curious if this and Hermes source map support are on the roadmap.

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

2 participants