sentry-react-native: Sentry doesn't work when Code-Push on my app.

Environment

Which SDK and version?

@sentry/react-native: 3.2.10

Steps to Reproduce

When applied with a code push, the centry does not work. I followed the guide, but the problem still remains…

my code:

    useEffect(() => {
        const checkAndGetCodePush = async () => {
            try {
                let result = await CodePush.checkForUpdate();
                if (result) {
                    setIsUpdating(true);
                    CodePush.sync(
                        {
                            installMode: CodePush.InstallMode.IMMEDIATE,
                            mandatoryInstallMode: CodePush.InstallMode.IMMEDIATE
                        },
                        async (status) => {
                            switch (status) {
                                case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
                                    break;
                                case CodePush.SyncStatus.INSTALLING_UPDATE:
                                    break;
                                case CodePush.SyncStatus.UPDATE_INSTALLED:

                                // Sentry
                                await CodePush.getUpdateMetadata().then(update => {
                                    if (update) {
                                        Sentry.init({
                                            environment: 'production',
                                            dsn: myDsn,
                                            tracesSampleRate: 1.0,
                                            enableNative: false,
                                            release: `${update.appVersion}+codepush:${update.label}`,
                                            dist: update.label,
                                        });
                                    }
                                });
                                setIsUpdating(false);
                                    break;
                                case CodePush.SyncStatus.SYNC_IN_PROGRESS:
                                    break;
                            }
                        },
                        (progress) => {
                            setSyncProgress(progress);
                        },
                    );
                } else {

                    await CodePush.getUpdateMetadata().then(update => {
                        if (update) {
                            Sentry.init({
                                environment: 'production',
                                dsn: myDsn,
                                tracesSampleRate: 1.0,
                                enableNative: false,
                                release: `${update.appVersion}+codepush:${update.label}`,
                                dist: update.label,
                            });
                        }
                    });
                    setIsUpdating(false);
                }
            } catch (err: any) {
                setIsUpdating(false);
            }
    }, []);


   ....


  return Sentry.wrap(codePush(codePushOptions)(App));

Action code push(android):

appcenter codepush release-react -a [name]/[app_name-android] -d Production --sourcemap-output --output-dir ./build

Currently, Sentry is not sending issues in my app. However, except for the Code-Push, the sentry operate normally. I don’t know what the problem is with the code…

Expected Result

What you thought would happen.

Actual Result

What actually happened. Maybe a screenshot/recording? Maybe some logs?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

@jennmueng

I feel dejected… It was solved when I changed enable Native to true…

        Sentry.init({
            ...
            enableNative: true,
        });

You helped me so kindly. It gave me strength!