question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native "Source code was not found" (hashed bundle name)

See original GitHub issue

Environment

How do you use Sentry? Sentry SaaS

Which SDK and version?

{
  "dependencies": {
    ...
    "@sentry/react-native": "^3.1.1",
    "react-native": "~0.63.4",
    ...
  },
}

Steps to Reproduce

Add Sentry to React Native project (configured as below) and create a release.

Expected Result

I expected Sentry to correctly detect the name of/path to my uploaded source map.

Actual Result

I’m getting this error: Screen Shot 2021-11-16 at 9 10 27 AM

Here are my uploaded artifacts: Screen Shot 2021-11-16 at 9 11 22 AM

I understand that these file names are supposed to match, but I’m unclear as to how I can match them up if Sentry is looking for those hashed bundle names (different hashes for each release it seems). Hopefully I’m missing something pretty obvious and this is an easy fix.

Here’s my config:

Sentry.init({
  dsn: "https://XXXX@XXXX.ingest.sentry.io/XXXX",
  debug: process.env.$ENVIRONMENT === "qa" || process.env.$ENVIRONMENT === "uat",
  tracesSampleRate: 0.25,
  integrations: [new Sentry.ReactNativeTracing({ routingInstrumentation })],
});

Any help you can provide would be much appreciated!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jennmuengcommented, Nov 17, 2021

@sethcwhiting I’m not sure myself and I have never worked with building apps on AppCenter, so assuming that these bundle hashes are generated by AppCenter, can you test and see if you add this integration, does sourcemaps work:

  integrations: [new RewriteFrames({
        iteratee: (frame: StackFrame) => {
          if (frame.filename) {
            frame.filename = frame.filename
              .replace(/^file:\/\//, "")
              .replace(/^address at /, "")
              .replace(/^.*\/[^.]+(\.app|CodePush|.*(?=\/))/, "");

             if (
              frame.filename !== "[native code]" &&
              frame.filename !== "native"
             ) {
              const appPrefix = "app://";
              // We always want to have a triple slash
              frame.filename =
                frame.filename.indexOf("/") === 0
                  ? `${appPrefix}${frame.filename}`
                  : `${appPrefix}/${frame.filename}`;
            }

           // Everything above this line is what we already do by default
           // Here it just replaces the filename for the bundle-hash files to main.jsbundle
           if (frame.filename.startsWith("app:///bundle-")) {
              frame.filename = "app:///main.jsbundle";
            }
          }
          return frame;
         },
      })]

This is just the default frame rewriting code we already have in the SDK by default, however just to see if just renaming the bundle name will work.

2reactions
sethcwhitingcommented, Nov 17, 2021

@jennmueng @marandaneto Thanks so much for your help 🙏🙏🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Native Bundle Error error SHA-1 for file is not computed
This issue was raise due to configure old project with old react-native version. and then trying to run latest react-native ver with new...
Read more >
React-Native: Source code was not found - #sentry
Hi, We're using Sentry with React-Native and are having problems with our sourcemap on iOS. This is the error we're getting: Source code...
Read more >
rollup.js
Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library...
Read more >
Facebook login in React native - Medium
Adding Facebook login to a react native app is cool feature. ... You can find Bundle identifier in Xcode General Tab . As...
Read more >
Parcel.js
The zero configuration build tool for the web.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found