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

Source code was not found for app:///index.bundle #376

Closed
2 of 5 tasks
Alqasrawi opened this issue Mar 18, 2018 · 10 comments
Closed
2 of 5 tasks

Source code was not found for app:///index.bundle #376

Alqasrawi opened this issue Mar 18, 2018 · 10 comments
Assignees

Comments

@Alqasrawi
Copy link

Alqasrawi commented Mar 18, 2018

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

Output of node -v && npm -v && npm ls --prod --depth=0

v6.11.3
3.10.10
[email protected] /Users/khaledalqasrawi/Development/namshi-android
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── UNMET PEER DEPENDENCY [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Config:

Sentry.config(
'🔑',
      { logLevel: SentryLog.Verbose },
    ).install();

I have following issue:
I get the "Source code was not found for app:///index.bundle" error on sentry.io dashboard

I added sentry to my react native app inside an existing Android app, I used the react-native link react-native-sentry command to integrate sentry in the project and I added:

apply from: "../../node_modules/react-native-sentry/sentry.gradle"

to app/build.gradle

The map file isn't uploaded to sentry and therefore the code is not reported with the crashes, only the stack trace.

Steps to reproduce:

  • add sentry to the existing project using react-native link command
  • add the sentry gradle file to the app's build.gradle file
  • run the app and throw an error inside the javascript code

Actual result:

  • only the javascript stacktrace is reported not the code

Expected result:

  • the javascript code should be reported as well with the stacktrace
@sentry-probot
Copy link

sentry-probot bot commented Mar 18, 2018

Hi there, I just edited this for you. Try not to post your DSN on GitHub.

@getsentry getsentry deleted a comment from sentry-probot bot Mar 19, 2018
@getsentry getsentry deleted a comment from sentry-probot bot Mar 19, 2018
@getsentry getsentry deleted a comment from sentry-probot bot Mar 19, 2018
@getsentry getsentry deleted a comment from sentry-probot bot Mar 19, 2018
@Alqasrawi
Copy link
Author

Should I upload the bundle and the source map manually to sentry ? is there any other information I should provide with the ticket ?

I tried uploading the bundle and the source map manually and I got a "Invalid token (401)" error

Command used to generate the bundle and the source map:

react-native bundle --platform android --entry-file index.js --bundle-output <path-to-assets>/index.bundle --sourcemap-output <path-to-assets>/index.bundle.map --assets-dest <path-to-resources> --dev false

Command used to upload the bundle and the source map to sentry:

./node_modules/.bin/sentry-cli --auth-token <auth-token> --url http://sentry.mm.taou.com releases -o <organization-name> -p <project-name> files 6.7 upload-sourcemaps --rewrite --validate <path-to-assets>/index.bundle <path-to-assets>/index.bundle.map --strip-prefix <path-to-assets>/

@HazAT
Copy link
Member

HazAT commented Mar 22, 2018

Hey, so it seems like you are using the wrong Auth Token.
This is not your DSN, did you call react-native link react-native-sentry?
This command should start the wizard and help you with the setup.
You can find your auth token here:
https://sentry.io/settings/account/api/auth-tokens/

@HazAT HazAT self-assigned this Mar 22, 2018
@Alqasrawi
Copy link
Author

Thanks for the reply, I managed to execute the upload command with the correct information, the files are uploaded now to sentry.io but I still get this error on sentry:

Source code was not found for app://index.bundle

the build artifacts names are the following:

~/index.bundle
~/index.bundle.map

@HazAT
Copy link
Member

HazAT commented Mar 22, 2018

Can you link an event here so I can take a look at it?

@Alqasrawi
Copy link
Author

As mentioned in Issue 338 I forgot to add the RNSentryPackage:

reactInstanceManager = ReactInstanceManager.builder()
                .setApplication(getActivity().getApplication())
                .addPackage(new MainReactPackage())
                .addPackage(new RNSentryPackage(null))
                .......
                .build();

P.S: I am integrating react native in an existing Android app, the react instance is managed inside a fragment, I didn't need to implement ReactApplication anywhere, I checked the source code for RNSentryPackage and the ReactApplication constructor argument is never used in the code. that's why I used null in the constructor.

@vivek-walecha-657-zz
Copy link

@Alqasrawi are you able to get the line number on sentry.
I need a serious help on this, but no one on the forums helping. Even the sentry people are not helping 👎

@HazAT
Copy link
Member

HazAT commented Jun 18, 2018

@vivek-walecha-657 Hey, no reason to be upset, I see your comment for the first time :)
What command are you running to upload the source maps? This error indicates that they are not uploaded?
Which version of react-native-sentry are you running?
Can you link me to one of your issues so I can take a look in your account?

@mattslight
Copy link

mattslight commented Nov 29, 2018

org = sharek
project = react-native
architecture = ios

@HazAT I have successfully generated sourcemaps via:-

react-native bundle --platform ios --entry-file index.js --dev true --bundle-output ./index.bundle --assets-dest ./dist/sourcemap.js

And then uploaded the generated sourcemap.js to sentry (this works)

sentry-cli releases files BUILDNAME upload-sourcemaps ./dist/ --dist BUILDNUMBER --strip-prefix ABSOLUTE_PATH_TO/index.js --no-rewrite

But still in the sentry console it tells me via sentry web portal Source code was not found for app:///index.bundle.

What am I doing wrong please?

*** EDIT *** I am using codePush so I am now following the instructions for that: https://docs.sentry.io/clients/react-native/codepush/

I am still seeing the error Source code was not found for app:///index.bundle.

I have now set up the codePush metadata hook as per

codePush.getUpdateMetadata().then(update => {
  if (update) {
    Sentry.setVersion(update.appVersion + '-codepush:' + update.label)
  }
})

and

The following command is successful:-

sentry-cli react-native appcenter APPCENTER_ID ios ./build/codePush

> Fetching latest AppCenter deployment info
> Processing react-native AppCenter sourcemaps
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
> Uploading source maps for release com.fake_domain.FakeApp.ios-0.23-codepush:v59

Source Map Upload Report
  Minified Scripts
    ~/main.jsbundle (sourcemap at main.jsbundle.map)
  Source Maps

@rdewolff
Copy link

For me, this getsentry/sentry-cli#233 helped, as the path I was using was just ./build and the correct one to use was ./build/codePush.

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

5 participants