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

feat(expo): Dynamically resolve sentry-cli path in expo source maps upload script #3507

Merged
merged 5 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

This release is compatible with `[email protected]` and newer.

### Features

- `withSentryExpoSerializers` changes to `getSentryExpoConfig` ([#3501](https://github.com/getsentry/sentry-react-native/pull/3501))
- `getSentryExpoConfig` accepts the same parameters as `getDefaultConfig` from `expo/metro-config` and returns Metro configuration
- This also works for EAS Updates (and expo export). Debug ID is generated by `expo/metro-config` and used by Sentry.
Expand All @@ -13,10 +15,24 @@ This release is compatible with `[email protected]` and newer.
const config = getSentryExpoConfig(config);
```

- Add `scripts/expo-upload-sourcemaps.js` for simple EAS Update (expo export) source maps upload to Sentry ([#3491](https://github.com/getsentry/sentry-react-native/pull/3491))

```bash
SENTRY_PROJECT=project-slug \
SENTRY_ORG=org-slug \
SENTRY_AUTH_TOKEN=super-secret-token \
node node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js dist
```

- Sentry CLI binary path in `scripts/expo-upload-sourcemaps.js` is resolved dynamically ([#3507](https://github.com/getsentry/sentry-react-native/pull/3507))
- Or can be overwritten by `SENTRY_CLI_EXECUTABLE` env

- Resolve Default Integrations based on current platform ([#3465](https://github.com/getsentry/sentry-react-native/pull/3465))
- Native Integrations are only added if Native Module is available
- Web Integrations only for React Native Web builds

### Fixes

- Includes fixes from version 5.15.2

## 5.15.2
Expand Down
6 changes: 3 additions & 3 deletions scripts/expo-upload-sourcemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ const process = require('process');
const SENTRY_PROJECT = 'SENTRY_PROJECT';
// The sentry org is inferred from the auth token
const SENTRY_AUTH_TOKEN = 'SENTRY_AUTH_TOKEN';

const SENTRY_CLI = 'node_modules/@sentry/cli/bin/sentry-cli';
const SENTRY_CLI_EXECUTABLE = 'SENTRY_CLI_EXECUTABLE';

function getEnvVar(varname) {
return process.env[varname];
Expand Down Expand Up @@ -103,6 +102,7 @@ function groupAssets(assetPaths) {

let sentryProject = getEnvVar(SENTRY_PROJECT);
let authToken = getEnvVar(SENTRY_AUTH_TOKEN);
const sentryCliBin = getEnvVar(SENTRY_CLI_EXECUTABLE) || require.resolve('@sentry/cli/bin/sentry-cli');

if (!sentryProject) {
console.log(`🐕 Fetching ${SENTRY_PROJECT} from expo config...`);
Expand Down Expand Up @@ -147,7 +147,7 @@ for (const [assetGroupName, assets] of Object.entries(groupedAssets)) {
}
console.log(`⬆️ Uploading ${assetGroupName} bundle and sourcemap...`);
const isHermes = assets.find(asset => asset.endsWith('.hbc'));
execSync(`${SENTRY_CLI} sourcemaps upload ${isHermes ? '--debug-id-reference' : ''} ${assets.join(' ')}`, {
execSync(`${sentryCliBin} sourcemaps upload ${isHermes ? '--debug-id-reference' : ''} ${assets.join(' ')}`, {
env: {
...process.env,
[SENTRY_PROJECT]: sentryProject,
Expand Down
Loading