Skip to content

fix: resolve sentry-cli relative to react-native package#6242

Open
shawnthye-guru wants to merge 2 commits into
getsentry:mainfrom
shawnthye-guru:fix/sentry-cli-resolution-6241
Open

fix: resolve sentry-cli relative to react-native package#6242
shawnthye-guru wants to merge 2 commits into
getsentry:mainfrom
shawnthye-guru:fix/sentry-cli-resolution-6241

Conversation

@shawnthye-guru
Copy link
Copy Markdown

Fixes #6241

Summary

  • resolve @sentry/cli from @sentry/react-native's package location in the Android Gradle integration
  • use the same dependency-relative resolver in both iOS Xcode upload scripts
  • add a focused test that guards the resolver expression across Android and iOS scripts

Why

Package managers with isolated dependency layouts, such as pnpm, may not make @sentry/cli directly resolvable from the app's native project directory even though it is available as a dependency of @sentry/react-native. Resolving with { paths: [require.resolve('@sentry/react-native/package.json')] } lets Node resolve the CLI from the React Native SDK dependency graph before falling back to the existing pnpm shim parsing.

Validation

  • bash -n packages/core/scripts/sentry-xcode.sh
  • bash -n packages/core/scripts/sentry-xcode-debug-files.sh
  • git diff --check
  • verified the new resolver returns the pnpm store sentry-cli path in a pnpm React Native app where plain require.resolve('@sentry/cli/package.json') fails

Prior Art

This replaces #6240, which was auto-closed because it did not reference a GitHub issue.

@sdk-maintainer-bot
Copy link
Copy Markdown

This PR has been automatically closed. The referenced issue does not show a discussion between you and a maintainer.

To avoid wasted effort on both sides, please discuss your proposed approach in the issue first and wait for a maintainer to respond before opening a PR.

Please review our contributing guidelines for more details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix: resolve sentry-cli relative to react-native package by shawnthye-guru in #6242
  • fix(tracing): Enable fetch instrumentation when expo/fetch is active by antonis in #6226
  • fix: Bump tmp to 0.2.7 to resolve path traversal vulnerability by antonis in #6233
  • feat(logs): Add enableAutoConsoleLogs option to opt out of console capture by alwx in #6235
  • chore(deps): update JavaScript SDK to v10.55.0 by github-actions in #6222
  • chore(deps): update Sentry Android Gradle Plugin to v6.9.0 by github-actions in #6230
  • refactor(android): Convert sentry.gradle to Kotlin DSL (sentry.gradle.kts) by antonis in #6119

🤖 This preview updates automatically when you update the PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The executable bit was removed from this file. I think we need to restore 755

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Jun 2, 2026
Comment on lines +30 to +33
const expoUploadSourcemapsScript = fs.readFileSync(
path.join(EXPO_UPLOAD_SOURCEMAPS_DIR, 'cli.js'),
'utf8',
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should make the linter happy

Suggested change
const expoUploadSourcemapsScript = fs.readFileSync(
path.join(EXPO_UPLOAD_SOURCEMAPS_DIR, 'cli.js'),
'utf8',
);
const expoUploadSourcemapsScript = fs.readFileSync(path.join(EXPO_UPLOAD_SOURCEMAPS_DIR, 'cli.js'), 'utf8');

Copy link
Copy Markdown
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @shawnthye-guru 🙇
Overall the PR looks good. I've only left a couple of comments.
Please also add a changelog entry to communicate the change. E.g. a fix entry like:

Resolve `sentry-cli` in isolated dependency layouts ([#6242](https://github.com/getsentry/sentry-react-native/pull/6242))

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 92d3ec5. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve sentry-cli relative to @sentry/react-native in isolated dependency layouts

3 participants