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

Unsymbolicated sentry stack traces #4118

Open
6 of 11 tasks
jayshah123 opened this issue Sep 25, 2024 · 9 comments
Open
6 of 11 tasks

Unsymbolicated sentry stack traces #4118

jayshah123 opened this issue Sep 25, 2024 · 9 comments

Comments

@jayshah123
Copy link

jayshah123 commented Sep 25, 2024

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: @sentry/react-native@5.20.0

react-native version: 0.73.9

Are you using Expo?

  • Yes - but in Bare workflow.
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

Link to issue

Configuration:

(@sentry/react-native)

  Sentry.init({
    dsn: SENTRY_DSN,
    environment: ENVIRONMENT,
    release: `${appJson.version}-${appJson.jsVersion}`,
    dist: `${appJson.versionCode}`,
    beforeSend: sentryFilter,
    enableTracing: false,
    attachStacktrace: true,
    enableWatchdogTerminationTracking: true,
    enableAutoPerformanceTracing: false,
  });

In our metro.config.js, we use @expo/metro-config as a starting point like below:

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */
const { getDefaultConfig } = require('@expo/metro-config');

const path = require('path');

async function getConfig(appDir) {
  const config = await getDefaultConfig(__dirname);
  // setup watch folders
  config.watchFolders = [path.resolve(appDir, 'node_modules')];
  // setup transformer
  config.transformer = {
    ...config.transformer,
    babelTransformerPath: require.resolve('react-native-svg-transformer/expo'),
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: true,
        inlineRequires: true,
      },
    }),
  };

  // setup resolver source extensions
  const originalSourceExts = config.resolver.sourceExts;
  let newSourceExts = process.env.RN_SRC_EXT
    ? process.env.RN_SRC_EXT.split(',').concat(originalSourceExts)
    : originalSourceExts;
  config.resolver.sourceExts = [...newSourceExts, 'svg', 'cjs', 'mjs'];

  // setup resolver asset extensions
  const origianlAssetExts = config.resolver.assetExts;
  config.resolver.assetExts = [
    ...origianlAssetExts.filter((ext) => ext !== 'svg'),
    'css',
    'scss',
  ];

  return config;
}

module.exports = getConfig(__dirname);

Upload steps for iOS (after codepush release-react):

                export SENTRY_PROPERTIES=./ios/sentry.properties
                npx react-native bundle --dev false --platform ios --entry-file index.js --bundle-output main.jsbundle --sourcemap-output main.jsbundle.map
                node_modules/@sentry/cli/bin/sentry-cli releases files $VERSION-$JSVERSION upload-sourcemaps --strip-prefix . --rewrite main.jsbundle main.jsbundle.map --dist $VERSIONCODE

Upload steps for Android (after codepush release-react):

                export SENTRY_PROPERTIES=./ios/sentry.properties
                npx react-native bundle --dev false --platform android --entry-file index.js --bundle-output index.android.bundle --sourcemap-output index.android.bundle.map
                node_modules/@sentry/cli/bin/sentry-cli releases files $VERSION-$JSVERSION upload-sourcemaps --strip-prefix . --rewrite index.android.bundle index.android.bundle.map --dist $VERSIONCODE

I have the following issue:

[Description]

  1. I have correct debugId appended in js bundle during release and same source/sourcemap is found in sentry.io.
  2. I don't see any "debugId" field in index.android.bundle.map json file.
  3. Currently # debugId comment in minified code bundle seems to be coming from: node_modules/@expo/metro-config/build/serializer/fork/baseJSBundle.js

Steps to reproduce:

  • Fire an error from android app via captureException

Actual result:

Unsymbolicated stack trace

Expected result:

Symbolicated stack trace.

@lucas-zimerman
Copy link
Collaborator

Hi and thank you for opening this issue!
Could you please share the commands you use to build the native app (both for iOS and Android)?

@jayshah123
Copy link
Author

The android native release happens through fastlane:

bundle exec fastlane android release_playstore
# upload sentry sourcemaps
export SENTRY_PROPERTIES=./android/sentry.properties
 npx react-native bundle --dev false --platform android --entry-file index.js --bundle-output index.android.bundle --sourcemap-output index.android.bundle.map
node_modules/@sentry/cli/bin/sentry-cli releases files $VERSION-$JSVERSION upload-sourcemaps --strip-prefix . --rewrite index.android.bundle index.android.bundle.map --dist $VERSIONCODE

Here are the contents of lane:

    desc "Build and upload the app to playstore for production release"
    lane :release_playstore do
        # Upload Android App Bundle to PlayStore
        upload_to_play_store(
            skip_upload_apk: true,
            skip_upload_metadata: true,
            skip_upload_changelogs: true,
            skip_upload_images: true,
            skip_upload_screenshots: true,
            aab: './android/app/build/outputs/bundle/release/app-release.aab',
            rollout: '0.1',
        )
    end

iOS native release also happens through fastlane

bundle exec fastlane ios build_appstore
bundle exec fastlane ios release_appstore
# upload sentry stuff
export SENTRY_PROPERTIES=./ios/sentry.properties
npx react-native bundle --dev false --platform ios --entry-file index.js --bundle-output main.jsbundle --sourcemap-output main.jsbundle.map
node_modules/@sentry/cli/bin/sentry-cli releases files $VERSION-$JSVERSION upload-sourcemaps --strip-prefix . --rewrite main.jsbundle main.jsbundle.map --dist $VERSIONCODE
bundle exec fastlane upload_debug_symbols_sentry_ios

Contents of fastlane:

  private_lane :publish_appstore do
    api_key = app_store_connect_api_key(
      key_id: ENV['APP_STORE_KEY_ID'],
      issuer_id: ENV['APP_STORE_ISSUER_ID'],
      key_filepath: ENV['APP_STORE_KEY_FILEPATH'],
      duration: 1200,
      in_house: false
    )

    upload_to_app_store(
      app_version: ENV['VERSION'],
      app_identifier: APP_ID,
      api_key: api_key,
      ipa: IPA_PATH,
      submit_for_review: true,
      automatic_release: false,
      skip_metadata: false,
      skip_screenshots: true,
      force: true,
      run_precheck_before_submit: false,
      # verify_only: true,
      submission_information: {
        add_id_info_uses_idfa: false
      },
      release_notes: {
        "default": 'Bug Fixes and Improvements',
        "en-US": 'Bug Fixes and Improvements'
      },
      phased_release: true
    )
  end

@kahest
Copy link
Member

kahest commented Sep 26, 2024

Thanks @jayshah123 for the detailled response, we'll investigate and follow up here.

@jayshah123
Copy link
Author

Thanks @kahest .
There is one more issue around:
App Hanging - "Sentry has identified the following problems for you to fix: A required debug information file was missing".
Should I raise a separate issue? Or provide the issue link in this same thread?

@kahest
Copy link
Member

kahest commented Sep 26, 2024

@jayshah123 a link would be appreciated. We can keep it in this current issue until we know if it's a separate one

@jayshah123
Copy link
Author

Link to the second issue here

@jayshah123
Copy link
Author

Let us know if something can be done here, we are trying to investigate this issue and missing symbolication makes it harder.

@krystofwoldrich
Copy link
Member

Hi,
thank you for the message,
we are in process of updation our CodePush documentation (https://github.com/getsentry/sentry-docs/pull/11550/files).

I see that you are missing the Sentry config in your Metro configuration.

The missing Sentry Config will cause that the generated Debug IDs are not used due to missing Debug ID polyfill.


The links you shared are containing native iOS crashes. To symbolicate those you need to make sure native Debug Files are uploaded. You can do that automatically during the Xcode build by using https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#configure-automatic-debug-symbols-upload

@jayshah123
Copy link
Author

Checking the same, and will report if face any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Community
Status: Needs More Information
Development

No branches or pull requests

4 participants