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

@sentry/react-native - Tracking Issue - Feedback #612

Closed
HazAT opened this issue Jul 3, 2019 · 160 comments

Comments

@HazAT
Copy link
Member

commented Jul 3, 2019

We just released the new version of our React Native SDK @sentry/react-native@1.0.0-beta.5 and we are looking for people to try it out and provide feedback.
https://www.npmjs.com/package/@sentry/react-native

  • Support for react-native >= 0.60
  • Use @sentry/browser
  • Supports autolinking
  • Supports ram bundles
  • Supports hermes

How to install it?

If you already have an existing React Native project install it with yarn like:

yarn add @sentry/react-native@1.0.0-beta.5

If you are using react-native <0.60 do:

react-native link @sentry/react-native

If react-native >=0.60 do:

yarn sentry-wizard -i reactNative -p ios android

After that, you need to

cd ios
pod install

always for project >= 0.60 and only if you have a Cocoapods setup if you run below 0.60.

What changed?

@sentry/react-native now joins the unified family and has pretty much the same API as @sentry/browser. There are also some internal improvements that should make the overall experience when using the SDK more stable and robust.

The new SDK is fully written in typescript and therefore provides full typing out of the box.

Upgrading from react-native-sentry

You first need to unlink the package like react-native unlink react-native-sentry.
Then remove it from your dependencies yarn remove react-native-sentry.

There are some code changes necessary you need to import and init the new SDK like this:

import * as Sentry from '@sentry/react-native';

Sentry.init({ 
  dsn: 'DSN', 
});

You can remove the code in your AppDelegate.m

#import <React/RNSentry.h>
...
- (BOOL)application:(UIAppl...
{
  ...
  [RNSentry installWithRootView:rootView];
  ...
}

CodePush

The function Sentry.setVersion has been dropped in favor of Sentry.setRelease (which exactly sets the string you set as the release name, without any magic).
Same goes for Sentry.setDist, it just sets the dist to the string you set.

Why?

Reason for this change is that since the initial release of our React Native SDK a lot has changed on both our and React Native side. We wanted to make sure that we can keep up with the pace and future features that are yet to come for Sentry.

New Features

On device symbolcation for Debug builds

We now have an integration that runs only in debug doing symbolication on the device. Providing a better stack trace for debug builds with correct line numbers and filenames for application frames.

Before
before

After
after

Whishlist

  • Use symbolicateStackTrace of react-native to symbolicate on device in Debug.
  • Check stacktrace merging

@HazAT HazAT self-assigned this Jul 3, 2019

@HazAT HazAT pinned this issue Jul 3, 2019

@Karniej

This comment was marked as resolved.

Copy link

commented Jul 3, 2019

Is it compatible with a newest React Native 0.60v , which has to install dependencies through Pods ?

@HazAT

This comment was marked as resolved.

Copy link
Member Author

commented Jul 4, 2019

@Karniej Will give it a try today.

@HazAT

This comment was marked as outdated.

Copy link
Member Author

commented Jul 4, 2019

Notifying a few specific ppl to hope to get feedback :)
@pvinis @AleksandrZhukov

@pvinis

This comment was marked as resolved.

Copy link

commented Jul 4, 2019

ill try it in the next few days! :D

@AleksandrZhukov

This comment was marked as resolved.

Copy link

commented Jul 4, 2019

will try to test it today

@HazAT

This comment was marked as outdated.

Copy link
Member Author

commented Jul 4, 2019

Cool thanks guys :)
Quick update, coincidentally Facebook released 0.60 a few hours ago https://facebook.github.io/react-native/blog/2019/07/03/version-60
The whole linking process changed, so it will not work out of the box I am working on this now.
It's highly likely that @sentry/react-native will only support react-native >= 0.60

Will update the thread here.

@HazAT

This comment was marked as resolved.

Copy link
Member Author

commented Jul 4, 2019

I just released 1.0.0-beta.1 and it should work with react-native >= 0.60

@AleksandrZhukov

This comment was marked as resolved.

Copy link

commented Jul 4, 2019

it is compatible with RN < 60?

@HazAT

This comment was marked as resolved.

Copy link
Member Author

commented Jul 4, 2019

@AleksandrZhukov Yes, I tried it with both 0.60 and 0.59.
I think it should be compatible as far back as 0.56

@Karniej

This comment was marked as resolved.

Copy link

commented Jul 4, 2019

I just tried adding the v.0.60 RN Project and still got this alert

[!] Invalid `Podfile` file: 784: unexpected token at '- @sentry/react-native: https://github.com/getsentry/sentry-react-native

Please notify their maintainers about it. You can find more details at https://react-native-community/cli/docs/configuration.md#migration-guide.
@HazAT

This comment was marked as resolved.

Copy link
Member Author

commented Jul 4, 2019

@Karniej Please make sure to install it with yarn add @sentry/react-native@1.0.0-beta.1 to make sure you use beta.1.
I just tried it with a clean project and it works for me.

@Karniej

This comment was marked as resolved.

Copy link

commented Jul 4, 2019

@HazAT Ahh yes , I made a mistake here before. This fortunately works now for me :)

@msqar

This comment was marked as resolved.

Copy link

commented Jul 4, 2019

@HazAT hey :D how do i install it with npm?

@AleksandrZhukov

This comment was marked as resolved.

Copy link

commented Jul 5, 2019

@msqar same as with yarn - npm i @sentry/react-native@1.0.0-beta.1

@Psiiirus

This comment was marked as resolved.

Copy link

commented Jul 9, 2019

Hiya,
if i do the pod install i get this error:

[!] CocoaPods could not find compatible versions for pod "Sentry":
  In Podfile:
    RNSentry (from `/Users/xxxx/_Entwicklung/react-native/xxx/node_modules/@sentry/react-native`) was resolved to 1.0.0-beta.1, which depends on
      Sentry (~> 4.4.0)

None of your spec sources contain a spec satisfying the dependency: `Sentry (~> 4.4.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

Unf. i don't really get which Sentry@4.4.0 i need?!

@Psiiirus

This comment was marked as resolved.

Copy link

commented Jul 9, 2019

Hiya,
if i do the pod install i get this error:

[!] CocoaPods could not find compatible versions for pod "Sentry":
  In Podfile:
    RNSentry (from `/Users/xxxx/_Entwicklung/react-native/xxx/node_modules/@sentry/react-native`) was resolved to 1.0.0-beta.1, which depends on
      Sentry (~> 4.4.0)

None of your spec sources contain a spec satisfying the dependency: `Sentry (~> 4.4.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

Unf. i don't really get which Sentry@4.4.0 i need?!

FYI: Seems "pod repo update" did it also made a gem install cocopods to update from 1.0 to 1.7.3

@cihati

This comment was marked as resolved.

Copy link

commented Jul 9, 2019

@Psiiirus

This comment was marked as resolved.

Copy link

commented Jul 9, 2019

Does this have Android X support? https://facebook.github.io/react-native/blog/#androidx-support

well should be #613

@HazAT

This comment has been minimized.

Copy link
Member Author

commented Aug 1, 2019

@christhegrand I think this can also be safely removed

@BYK

This comment has been minimized.

Copy link

commented Aug 1, 2019

@saschak42 - I'm planning to look into the nohoist issue in yarn soon but I'm guessing it won't be soon enough for you as this seems pretty urgent on your end. Would this help you in the meantime: https://til.hashrocket.com/posts/oxmc7kencg-alias-an-npm-package-with-yarn-add

This way, you should be able to rename the @sentry/react-native to something else but it should still work.

@spenciefy

This comment has been minimized.

Copy link

commented Aug 1, 2019

@HazAT I'm getting an issue on iOS crashes where the "Source code was not found" while processing the event. The bundle and source map appear to be uploaded correctly, but the Url path to the source seems to be wrong: /var/containers/Bundle/Application/D31A5707-DDCA-4A0C-8CD7-52C6AA10E84E/[Appname].app/main.jsbundle

Before, the path used to be stripped so it was only looking for /main.jsbundle, but now it looks like the local path with UUID is part of the Url? I could be missing something obvious here, but it's strange since Android crashes are processed correctly with the source map + source.

Thanks for all your work on this!

@saschak42

This comment has been minimized.

Copy link

commented Aug 2, 2019

@BYK Thanks, your suggested workaround works! :)

@HazAT We have still one last problem, because we use an Android buildscript which generates aar-files from our RN dependencies. We need this, because the IDE would be completely overloaded with the many dependencies we use. We tried it, but Android Studio often behaved odd and we needed to restart it a few times a day...

Now our script fails, because the Sentry build.gradle file is incomplete. I don't know how this can even work, but we have seen this also in a few other RN libraries. Maybe you can explain that to me. I've looked at this and got it to work. I've added the missing repositories and also the Android Gradle plugin:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "$rootDir/../../../react-native/android"
        }
    }
}

I also needed to update the compileSdkVersion and the targetSdkVersion to 28 and change the sentry-android import from implementation to api. Have you any ideas on this?

@vshab

This comment has been minimized.

Copy link

commented Aug 2, 2019

Can integrations be used with React Native now?

@msqar

This comment has been minimized.

Copy link

commented Aug 3, 2019

Guys, on Android is throwing:
Warning, could not cnonect to Sentry native SDK. Did you forget to run react-native link @sentry/react-native?

But i ran that already, it's supposed to be linked, any idea of why this is still being thrown?

@crubier

This comment has been minimized.

Copy link

commented Aug 4, 2019

When building on ios with react native 0.60.4 and beta.7 , I get this

Screenshot 2019-08-04 at 16 12 12

Any idea ?

@SuddenH4X

This comment has been minimized.

Copy link

commented Aug 7, 2019

We've just implemented the beta SDK, but we hadn't installed the stable beta before. The crashes appear correctly within Sentry, but we have two questions about the mappings/sourcemaps/dSYM uploads:

  1. The sentry-android-gradle-plugin uploads the Android mappings file correctly and the desymbolication works, but we can't see it under the artifacts tab of the release. Is this the expected behaviour? If so, where can we find the uploaded mappings file?
  2. The JS sourcemaps and the iOS dSYM files weren't uploaded. Is there a similar library (like sentry-android-gradle-plugin on Android) for iOS and the RN part? Or do we need to use the sentry-cli?
@SuddenH4X

This comment has been minimized.

Copy link

commented Aug 7, 2019

We've just uploaded the Android RN sourcemaps manually via sentry-cli and the sourcemaps are visible within the artifacts tab of the release. But the issue is not deobfuscated by sentry. Do you have any ideas? https://sentry.io/organizations/dmtech/issues/1143322943/?project=1516691&statsPeriod=14d

@ricbermo

This comment has been minimized.

Copy link

commented Aug 16, 2019

Hi, on react-native-sentry I can find this setting handlePromiseRejection to disable any HTTP rejection reports. How can I achieve that using @sentry/react-native? I wasn't able to find anything related to that.

@HazAT

This comment has been minimized.

Copy link
Member Author

commented Aug 19, 2019

@saschak42 I am not sure what you mean with the gradle file, you mean our current file is broken?

@spenciefy This is odd, the new SDK should do the same. Is this a release build? Is this iOS?

Can integrations be used with React Native now?

@vshab Yes, they can.

@msqar This indicates that autolinking didn't work, what version of react-native are you running?
Do other packages with a native integration work?

@crubier Did you upgrade your project? What version of react-native are you running and what steps did you take to install the SDK?

@SuddenH4X

  1. Yes, this is expected behaviour.
  2. You should use sentry-cli, yes. If you ran the wizard it should add a build step that does this for you, otherwise check this out https://docs.sentry.io/clients/react-native/manual-setup/#ios

The issue you linked is no longer available, but in order for the symbolication to work the release name + dist of the artifact need to match the tags in the event.

@msqar

This comment has been minimized.

Copy link

commented Aug 19, 2019

@HazAT I'm currently using 0.60.4 but i used to have 0.59. So i had to manually update my entire project whenever i updated it. Do you think linking gone wrong? it's possible... how does the linking work? And how is that handled?

This is my react-native.config.js

module.exports = {
    dependencies: {
        'react-native-device-info': {
            platforms: {
                ios: null,
                android: null
            }
        }
    },
    assets: [
        "./src/assets/fonts/"
    ]
};

I made sure i had exactly EVERY change that was dropped on 0.60.4 in terms of configuration and versioning but i might be failling on something, everything works except for autolinking?

@HazAT

This comment has been minimized.

Copy link
Member Author

commented Aug 20, 2019

@msqar In my experience, upgrading never works without issues.
Do

rm -rf node_modules
yarn install
react-native unlink @sentry/react-native
react-native link @sentry/react-native
@lucasfalcaojump

This comment has been minimized.

Copy link

commented Aug 22, 2019

@Genitivo did you solve your problem? I'm having the same issue when I try to build to release my app. @HazAT any suggestion? Looks like the problem is that the file 'index.android.bundle.packager.map' isn't being created on the directory, correct me if I'm wrong.

My stacktrace:

> Task :app:bundleReleaseJsAndAssets_SentryUpload FAILED INFO 2019-08-22 11:38:24.656279 -03:00 Loaded config from /Users/{my_user}/.sentryclirc DEBUG 2019-08-22 11:38:24.656753 -03:00 sentry-cli version: 1.47.1, platform: "darwin", architecture: "x86_64" INFO 2019-08-22 11:38:24.656771 -03:00 sentry-cli was invoked with the following command line: "/Users/{my_user}/Desktop/{my_project}/node_modules/@sentry/cli/sentry-cli" "--log-level" "debug" "react-native" "gradle" "--bundle" "/Users/{my_user}/Desktop/{my_project}/android/app/build/generated/assets/react/release/index.android.bundle" "--sourcemap" "/Users/{my_user}/Desktop/{my_project}/android/app/build/intermediates/sourcemaps/release/index.android.bundle.packager.map" "--release" "{my_android_release}" "--dist" "27" INFO 2019-08-22 11:38:24.658722 -03:00 bundle path: /Users/{my_user}/Desktop/{my_project}/android/app/build/generated/assets/react/release/index.android.bundle Processing react-native sourcemaps for Sentry upload. INFO 2019-08-22 11:38:24.658737 -03:00 sourcemap path: /Users/{my_user}/Desktop/{my_project}/android/app/build/intermediates/sourcemaps/release/index.android.bundle.packager.map > Analyzing 2 sources DEBUG 2019-08-22 11:38:24.658781 -03:00 Non-file bundle found DEBUG 2019-08-22 11:38:24.658851 -03:00 error: running update nagger DEBUG 2019-08-22 11:38:24.658864 -03:00 skipping update nagger because session is not attended error: No such file or directory (os error 2) DEBUG 2019-08-22 11:38:24.659374 -03:00 client close; no transport to shut down (from sentry)

VERSIONS:
React Native: "0.60.3",
Sentry: "@sentry/react-native": "1.0.0-beta.5"

@Genitivo

This comment has been minimized.

Copy link

commented Aug 22, 2019

@lucasfalcaojump I am able to create release builds, but in the Sentry's dashboard I can't see the updated build.
I'm currently on 1.0.0-beta.4 version.

Remember to substitute every com.android.support implementation with androidx and use jetify after you reinstall sentry.

Everything is beautiful, but I still don't see the RELEASE in the Sentry's dashboard of the project, so I solve only a piece of the problem.

@lucasfalcaojump

This comment has been minimized.

Copy link

commented Aug 22, 2019

@Genitivo , Thanks! You helped me a lot with your tips, but still isn't working to release... So I have to remove Sentry for now.

@Minishlink

This comment has been minimized.

Copy link

commented Aug 23, 2019

Hello there, we have found a crash with Sentry.setRelease('test') after a Sentry.init with the following devices:

  • Huawei P8 lite 2017 | Android 7.0
  • One Plus Fouz | Android 9.0

The error message is:

com.facebook.react.bridge.UnexpectedNativeTypeException: Value for message cannot be cast from ReadableNativeMap to String

@radik

This comment has been minimized.

Copy link

commented Aug 23, 2019

@Minishlink I have the same in emulator with
"@sentry/react-native": "1.0.0-beta.5",

@webforuse

This comment has been minimized.

Copy link

commented Aug 23, 2019

Hi, all.
I found problem.
Sentry not sending anything in dashboard (server) if device use Android 9 or 9.1 ,
Android 7, 8 and iOS is work fine

used: "@sentry/react-native": "1.0.0-beta.5",

@radik

This comment has been minimized.

Copy link

commented Aug 25, 2019

I have a problem with uploading sourcemap:

> Task :app:bundleReleaseJsAndAssets_SentryUpload FAILED
  INFO    2019-08-23 17:40:28.156469 +03:00 Loaded config from /Users/{username}/.sentryclirc
  DEBUG   2019-08-23 17:40:28.157220 +03:00 sentry-cli version: 1.47.1, platform: "darwin", architecture: "x86_64"
  INFO    2019-08-23 17:40:28.157241 +03:00 sentry-cli was invoked with the following command line: "/Users/{username}/projects/{project_path}/node_modules/@sentry/cli/sentry-cli" "react-native" "gradle" "--bundle" "/Users/{username}/projects/{project_path}/android/app/build/generated/assets/react/release/index.android.bundle" "--sourcemap" "/Users/{username}/projects/{project_path}/android/app/build/intermediates/sourcemaps/release/index.android.bundle.packager.map" "--release" "net.clickclickdrive.mobile-1.9.0" "--dist" "342"
Processing react-native sourcemaps for Sentry upload.
  INFO    2019-08-23 17:40:28.159676 +03:00   bundle path: /Users/{username}/projects/{project_path}/android/app/build/generated/assets/react/release/index.android.bundle
> Analyzing 2 sources
  INFO    2019-08-23 17:40:28.159694 +03:00   sourcemap path: /Users/{username}/projects/{project_path}/android/app/build/intermediates/sourcemaps/release/index.android.bundle.packager.map
  DEBUG   2019-08-23 17:40:28.159781 +03:00 Non-file bundle found
  DEBUG   2019-08-23 17:40:28.458998 +03:00 error: running update nagger
  DEBUG   2019-08-23 17:40:28.459039 +03:00 skipping update nagger because session is not attended
error: No such file or directory (os error 2)
  DEBUG   2019-08-23 17:40:28.459658 +03:00 client close; no transport to shut down  (from sentry)

FAILURE: Build failed with an exception.

I found that the sourcemap that I have differs from what sentry-cli looks for:

I have:

$ ls  /Users/{usrename}/projects/{project_path}/android/app/build/generated/assets/react/release/
index.android.bundle     index.android.bundle.map

sentry-cli looks for:

> Analyzing 2 sources
  INFO    2019-08-23 17:40:28.159694 +03:00   sourcemap path: /Users/{usrename}/projects/{project_path}/android/app/build/intermediates/sourcemaps/release/index.android.bundle.packager.map
  DEBUG   2019-08-23 17:40:28.159781 +03:00 Non-file bundle found

Is there a way to specify sourcemap manually

@radik

This comment has been minimized.

Copy link

commented Aug 25, 2019

Also, see my comment #641 (comment) - in my case failure reason is ambiguity in a sourcemap output file name

@webforuse

This comment has been minimized.

Copy link

commented Aug 26, 2019

Also managed to find out
#612 (comment)
If building debug APK (only for Android 9) is work fine, if build release APK not working, capture exceptions, messages and events

@HazAT HazAT referenced this issue Sep 2, 2019
4 of 9 tasks complete
@HazAT

This comment has been minimized.

Copy link
Member Author

commented Sep 2, 2019

@sentry/react-native 1.0.0 has been released and the docs page has been updated see: https://docs.sentry.io/platforms/react-native/

I am closing this issue as of now, please consider opening new issues from now on since this thread is already quite large.

@HazAT HazAT closed this Sep 2, 2019

@HazAT HazAT unpinned this issue Sep 2, 2019

@canastro

This comment has been minimized.

Copy link

commented Sep 2, 2019

@HazAT which issue should we follow to track Hermes support?

@HazAT

This comment has been minimized.

Copy link
Member Author

commented Sep 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.