"Source code was not found" when sourcemaps available

I’m seeing this message for events coming from the latest build of our RN Android app:

There was 1 error encountered while processing this event

  • Source code was not found Collapse

Url app:///at index.android.bundle

That file, together with its sourcemap, has been uploaded for that release and distribution, though, so I’m not sure why I’m seeing this “source code was not found” message. What could cause this? We’re using RN Sentry 1.0.0-beta 6, and RN 0.60.4. We also just switched to using react-native-v8 instead of the default RN JS interpreter - could that be related?

Sample bad event: Sign In | Sentry

You can see that the bundle and sourcemap were uploaded here: Sign In | Sentry

Something curious to note is that our 0.1.4 release has stack traces that say “app:///at index.android.bundle” while the 0.1.3 release (where we were not uploading sourcemaps or using react-native-v8) has stack traces that say “app:///index.android.bundle”.

Yes, the issue for sure is that the frame location is app:///at index.android.bundle
the at is messing up our matching.

What you can do is changing the RewriteFramesIntegration to fit you needs:

import { RewriteFrames } from "@sentry/integrations";

const rewriteFramesIntegration = new RewriteFrames({
  iteratee: frame => {
    if (frame.filename) {
      frame.filename = frame.filename
        .replace(/^file\:\/\//, "")
        .replace(/^address at /, "")
        .replace(/^.*\/[^\.]+(\.app|CodePush|.*(?=\/))/, "");
 // Add additional regex here to fix the `at` issue

      const appPrefix = "app://";
      // We always want to have a tripple slash
      frame.filename =
        frame.filename.indexOf("/") === 0
          ? `${appPrefix}${frame.filename}`
          : `${appPrefix}/${frame.filename}`;
    }
    return frame;
  }
});

Sentry.init({
  dsn: "your DSN",
  integrations: [rewriteFramesIntegration],
});

Hope that helps.

2 Likes

Thanks. I’ve got another question and I’m wondering if it’s related to the rewriteFramesIntegration change. The new build of our Android app, which includes the rewriteFramesIntegration change and is using RN Sentry 1.0.6 instead of RN Sentry beta 1.0.0-beta.6, is reporting a bunch of events that look like this:

{ NativeMap: {"stringified":"TypeError: Network request failed","name":"TypeError","message":"Network request failed","stack":["TypeError: Network request failed","    at S.y.onerror (mailworker.bundle:209:7272)","    at S.dispatchEvent (mailworker.bundle:198:5672)","    at S.value (mailworker.bundle:197:6082)","    at S.value (mailworker.bundle:197:2822)","    at mailworker.bundle:197:5019","    at p.value (mailworker.bundle:129:1275)","    at c.value (mailworker.bundle:108:3513)","    at mailworker.bundle:108:808","    at c.value (mailworker.bundle:108:2771)","    at c.value (mailworker.bundle:108:787)"],"error":{}} }

Why would some events be reported as NativeMap objects like this? This particular event includes a stack trace but it’s not formatted in the way I would expect, and it’s not symbolicated (the mailworker.bundle and its sourcemap were uploaded when the app was built).

We also seem to be missing stack traces for some errors that included stack traces in our last build. Here’s an example.

This event has a symbolicated stack trace (although not a very useful one). This one does not. The build in the first error is using RN Sentry 1.0.0-beta.6, without this rewriteFramesIntegration change. The build in the second error is using RN Sentry 1.0.6 with V8 and the rewriteFramesIntegration change.

This is a great example that would be awesome to have on this page.

I have a somewhat related question. I am deploying electron with static js files which has a similar problem. I am at a bit of loss as to which paths I should be expecting on Windows platform.

I am hoping to have my rewrite function to catch both Windows and Mac based stack traces. I am using the following regex to target the paths.

    frame.filename = frame.filename.replace(/^file\:\/\/.*\/static\/js/, '~')

Should I be expecting the paths from Windows and Mac to match as per documentation page mentioned above or should I expect the reversed slashes coming from windows as seen in this test https://github.com/getsentry/sentry-javascript/blob/bbd81b6d5e879101c75ad2527f023380573812c6/packages/integrations/test/rewriteframes.test.ts#L34

i am writing a test around this integration on my app and I wanted to clarify this behavior so I have good coverage