diff --git a/.github/workflows/bundle-deploy-eas-update.yml b/.github/workflows/bundle-deploy-eas-update.yml index a60821f928..69dd861051 100644 --- a/.github/workflows/bundle-deploy-eas-update.yml +++ b/.github/workflows/bundle-deploy-eas-update.yml @@ -156,7 +156,6 @@ jobs: run: > SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_RELEASE=${{ steps.env.outputs.EXPO_PUBLIC_RELEASE_VERSION }} - SENTRY_DIST=${{ steps.env.outputs.EXPO_PUBLIC_BUNDLE_IDENTIFIER }} pnpm export - name: 📦 Package Bundle and 🚀 Deploy diff --git a/.github/workflows/pull-request-comment.yml b/.github/workflows/pull-request-comment.yml index 0d2b74aeec..da2c331345 100644 --- a/.github/workflows/pull-request-comment.yml +++ b/.github/workflows/pull-request-comment.yml @@ -182,7 +182,6 @@ jobs: run: > SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_RELEASE=${{ steps.env.outputs.EXPO_PUBLIC_RELEASE_VERSION }} - SENTRY_DIST=${{ steps.env.outputs.EXPO_PUBLIC_BUNDLE_IDENTIFIER }} pnpm export - name: 📦 Package Bundle and 🚀 Deploy diff --git a/docs/build.md b/docs/build.md index 436a1197d0..8099b7af02 100644 --- a/docs/build.md +++ b/docs/build.md @@ -169,27 +169,13 @@ See [testing.md](./testing.md). ### Sentry sourcemaps -Sourcemaps should automatically be updated when a signed build is created using `eas build` and published using `eas submit` due to the postPublish hook setup in `app.json`. However, if an update is created and published OTA using `eas update`, we need to take the following steps to upload sourcemaps to Sentry: +Sourcemaps upload automatically as part of each build path; there are no manual steps. -- Run eas update. This will generate a dist folder in your project root, which contains your JavaScript bundles and source maps. This command will also output the 'Android update ID' and 'iOS update ID' that we'll need in the next step. -- Copy or rename the bundle names in the `dist/bundles` folder to match `index.android.bundle` (Android) or `main.jsbundle` (iOS). -- Next, you can use the Sentry CLI to upload your bundles and source maps: - - release name should be set to `${bundleIdentifier}@${version}+${buildNumber}` (iOS) or `${androidPackage}@${version}+${versionCode}` (Android), so for example `com.domain.myapp@1.0.0+1`. - - `dist` should be set to the Update ID that `eas update` generated. -- Command for Android: - `node_modules/@sentry/cli/bin/sentry-cli releases \ -files \ -upload-sourcemaps \ ---dist \ ---rewrite \ -dist/bundles/index.android.bundle dist/bundles/android-.map` -- Command for iOS: - `node_modules/@sentry/cli/bin/sentry-cli releases \ -files \ -upload-sourcemaps \ ---dist \ ---rewrite \ -dist/bundles/main.jsbundle dist/bundles/ios-.map` +- Native builds (`eas build` for iOS/Android): the `@sentry/react-native` Xcode build phase and Gradle plugin upload sourcemaps during the build. `SENTRY_AUTH_TOKEN`, `SENTRY_RELEASE`, and `SENTRY_DIST` are provided by the build workflows and read natively. +- OTA updates: `pnpm export` runs `expo export --dump-sourcemap` and then `pnpm upload-native-sourcemaps`, which invokes `@sentry/expo-upload-sourcemaps` on the `dist/` folder. The org and project are read from the Sentry plugin config in `app.config.js`; `SENTRY_AUTH_TOKEN` is required and `SENTRY_RELEASE` is optional (it only lets you browse the artifacts under a release in the Sentry UI). +- Web (`pnpm build-web`): `@sentry/webpack-plugin` uploads sourcemaps during the Docker web build. + +Matching is by debug ID end-to-end: the Metro serializer stamps a debugId into the bundle and its map, the upload passes `--debug-id-reference`, and at runtime the event's `debug_meta` carries the same id. Release/dist is only a legacy fallback, which is why OTA uploads no longer pass a dist. ### OTA updates diff --git a/package.json b/package.json index 3dd3663a32..19bb4065b9 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "nuke": "rm -rf ./node_modules && rm -rf ./ios && rm -rf ./android", "update-extensions": "bash scripts/updateExtensions.sh", "export": "expo export --dump-sourcemap && pnpm upload-native-sourcemaps", - "upload-native-sourcemaps": "pnpm exec sentry-expo-upload-sourcemaps dist", + "upload-native-sourcemaps": "pnpm exec expo-upload-sourcemaps dist", "make-deploy-bundle": "bash scripts/bundleUpdate.sh", "generate-webpack-stats-file": "EXPO_PUBLIC_GENERATE_STATS=1 pnpm build-web", "open-analyzer": "EXPO_PUBLIC_OPEN_ANALYZER=1 pnpm build-web", @@ -261,6 +261,7 @@ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15", "@react-native/babel-preset": "0.81.5", "@react-native/typescript-config": "^0.81.5", + "@sentry/expo-upload-sourcemaps": "~8.18.0", "@sentry/webpack-plugin": "^3.2.2", "@testing-library/react-native": "^13.2.0", "@types/jest": "29.5.14", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b6ebf781cd..995e49a7b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -739,6 +739,9 @@ importers: '@react-native/typescript-config': specifier: ^0.81.5 version: 0.81.6 + '@sentry/expo-upload-sourcemaps': + specifier: ~8.18.0 + version: 8.18.0(@expo/env@2.0.11)(dotenv@16.6.1) '@sentry/webpack-plugin': specifier: ^3.2.2 version: 3.6.1(webpack@5.106.2(postcss@8.5.14))