Question about releases and react-native

Hello everyone, I have a few questions about how to create releases for a react-native project. We are currently using Appcenter to create builds. I am not using sentry-wizard, I’m doing the following, after an Appcenter build ends:

if [ "$AGENT_JOBSTATUS" = "Succeeded" ];  then
  printf "\nGenerating source maps"
  # source our .env file and export the variables to be used next by sentry
  cat $APPCENTER_SOURCE_DIRECTORY/.env
  eval $(grep -v '^#' $APPCENTER_SOURCE_DIRECTORY/.env | sed 's/^/export /')
  # end exporting
  npx react-native bundle --entry-file index.js --platform $APPCENTER_CURRENT_PLATFORM --dev false --bundle-output $APPCENTER_OUTPUT_DIRECTORY/index.main.bundle --sourcemap-output $APPCENTER_OUTPUT_DIRECTORY/index.main.bundle.map
  printf "\nCreating a Sentry release with id $RELEASE_VERSION"
  # Create a release
   yarn sentry-cli releases new -p "$SENTRY_PROJECT" "$RELEASE_VERSION"
   yarn sentry-cli releases set-commits --auto "$RELEASE_VERSION" --log-level debug
   yarn sentry-cli releases files $RELEASE_VERSION upload-sourcemaps $APPCENTER_OUTPUT_DIRECTORY/index.main.bundle* --dist $APPCENTER_BUILD_ID --rewrite --strip-common-prefix
   yarn sentry-cli releases finalize "$RELEASE_VERSION"
   yarn sentry-cli releases deploys "$RELEASE_VERSION" new -e "$APP_ENV"
   echo "Sentry release created"
fi

$RELEASE_VERSION is in the format: com.aa.bb@1.0+$APPCENTER_BUILD_ID
$APPCENTER_CURRENT_PLATFORM is either iOS or Android

I have enabled Github integration on my account.

I’m doing this for both platforms. So the first question: is

  1. Is this correct? Should I create two releases, one for iOS and one for Android?
    For eg: a release name for Android is com.thexcompany.app.staging@1.0+132, and a release name for ios is: com.thexcompany.app.staging@1.0+1602856788

Second issue:
I’m using sentry-cli to set commits as you can see on the script. The thing is that I only get commits associated to the very first build that completes. It meas that if Appcenter first creates a release for Android, only this release gets commit history, but not the ios release

Third issue:
I have enabled native crash support. But when I have a native crash, it looks like the issue reported to Sentry is not associated to a release, because the environment is always set to prodiction and we don’t have a production environment yet.

Fourth issue:
It looks like issues associated with the ios release are not reading sourcemaps, although I can see sourcemaps uploaded in the release created on sentry

This is how I initialize Sentry from react-native:

Sentry.init({
    dsn: config.SENTRY_DSN,
    enableAutoSessionTracking: true,
    release: config.RELEASE_VERSION, // this special env is created on AppCenter automatically
    dist: config.BUILD_ID, // this special env is created on AppCenter automatically
    environment: config.ENV, // either staging or production
    enableNativeCrashHandling: true,
  });

The main quesiton is: should I create a release for both platforms? Or I need to create only one release, either on the android build, or on the ios build, and then reference that release when I initialize Sentry from react-native?

I have read all the documentation available and I couldn’t find anything yet. I’ll appreciate some help from the community.

Thanks in advance!

1 Like