getsentry / sentry-react-native

Official Sentry SDK for React-Native
https://sentry.io
MIT License
1.55k stars 325 forks source link

Support React Native for Windows #1407

Open bruno-garcia opened 3 years ago

bruno-garcia commented 3 years ago

This issue is here to track demand for React Native for Windows. Please 👍 this issue if it's something you're looking forward to.

https://microsoft.github.io/react-native-windows/

jennmueng commented 3 years ago

Oh and as a note to everyone who sees this issue, you can run this Sentry RN SDK on React Native Windows to only capture JS layer errors right now. You would just need to pass enableNative: false when calling Sentry.init

bruno-garcia commented 3 years ago

We should add it to the docs, and a sample to: https://github.com/getsentry/examples

bruno-garcia commented 3 years ago

Removed from the docs for now since this is still a backlog item. Once we get this moving we can plan the docs work.

github-actions[bot] commented 2 years ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

ShivamJoker commented 2 years ago

Does anyone know how do I remove it from windows and macos ? It's giving me errors while compiling.

aschultz commented 2 years ago

@jennmueng We ran into an issue where setting enableNative: false isn't enough because some internal objects like ReactNativeTracing get created with default params that expect native support and cause integrations to be added that throw errors when you log any data.

Our config now looks like:

        // Native not supported in Sentry for react-native-windows
        enableNative: false,
        enableNativeNagger: false,

        integrations: [rewriteFramesIntegration, new Sentry.ReactNativeTracing({ enableNativeFramesTracking: false })],

        // Because of lack of support on Windows, we need to start our own session manually
        enableAutoSessionTracking: false,

        // Prevent Sentry from creating ReactNativeTracing with default options, which require native support
        enableAutoPerformanceTracking: false,
bruno-garcia commented 2 years ago

Does anyone know how do I remove it from windows and macos ? It's giving me errors while compiling.

Could you share the errors? It should't error, it will just not capture native crashes on Windows. Mac should actually work.

Arnoldnuo commented 2 years ago

@bruno-garcia I got this error when I use react-native-sentry, I just cannot run my react-native-macos application. The following build commands failed: CompileC Pods.build/Debug/RNSentry-macOS.build/Objects-normal/x86_64/RNSentry.o /node_modules/@sentry/react-native/ios/RNSentry.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'RNSentry-macOS' from project 'Pods') (1 failure)

marandaneto commented 2 years ago

@bruno-garcia I got this error when I use react-native-sentry, I just cannot run my react-native-macos application. The following build commands failed: CompileC Pods.build/Debug/RNSentry-macOS.build/Objects-normal/x86_64/RNSentry.o /node_modules/@sentry/react-native/ios/RNSentry.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'RNSentry-macOS' from project 'Pods') (1 failure)

This is an issue related to Windows, and not macOS, please relate to https://github.com/getsentry/sentry-react-native/issues/1813

namrog84 commented 2 years ago

Is there anyone looking at getting a RNW (windows) version implemented for native?

Or any expected timeline for this?

marandaneto commented 2 years ago

Is there anyone looking at getting a RNW (windows) version implemented for native?

Or any expected timeline for this?

So far not, we've not prioritized this yet, we'd love to review PRs tho :)

gillpeacegood commented 2 years ago

rewriteFramesIntegration

Hi aschultz is it possible you could give more info about how to construct or import the rewriteFramesIntegration

aschultz commented 2 years ago

@gillpeacegood This is what we have for that function:

/**
 * The filename we get from the stack often makes it very difficult to upload sourcemaps to Sentry
 * that match the bundle correctly. So here we flatten the filename to just index.bundle, so we
 * can upload sourcemaps corresponding to the same filename.
 */
const rewriteFramesIntegration = new RewriteFrames({
    iteratee: (frame: Sentry.StackFrame) => {
        if (frame.filename && frame.filename.includes("index")) {
            frame.filename = "app:///index.bundle";
        }

        return frame;
    },
});
majirosstefan commented 10 months ago

This is the error we get when building for macOS when using "@sentry/react-native": "^4.15.1":

Screenshot 2023-09-03 at 11 17 27 PM Screenshot 2023-09-03 at 11 17 58 PM
krystofwoldrich commented 10 months ago

@majirosstefan Thank you for the message, a better place for any further questions is https://github.com/getsentry/sentry-react-native/issues/1813.

This was fixed in https://github.com/getsentry/sentry-react-native/releases/tag/5.4.0, please upgrade to the v5 of the SDK.

afonso-tsx commented 8 months ago

Is it not possible to install sentry React Native for the JS/Android part, and run Sentry UWP with some exposed methods to a native module?

My app is using react native building to android and c# windows (uwp)

krystofwoldrich commented 8 months ago

@afonsopbarros Hi, thank you for the message.

Currently, you can use the package on Windows for RN JS, and for native you can install https://docs.sentry.io/platforms/native/#install and use it in your App.cpp as in any other native application. Or add https://docs.sentry.io/platforms/dotnet/ to your App.xaml.cs.

Note that you will have to upload the native debug symbols manually.