Skip to content

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

Open
shawnthye-guru wants to merge 4 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 4 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
  • feat(tracing): Wrap Expo Router push, replace, navigate, back, dismiss in addition to prefetch by alwx in #6221
  • chore(deps): bump jwt in /samples/react-native by antonis in #6251
  • feat(profiling): Add measurements to Android profiling by antonis in #6250
  • chore(deps): update CLI to v3.5.0 by github-actions in #6248
  • chore(deps): bump jwt from 2.9.3 to 2.10.3 in /samples/react-native-macos by dependabot in #6247
  • chore(deps): bump jwt from 2.10.2 to 2.10.3 in /performance-tests by dependabot in #6246
  • feat(android): Warn when Gradle resolves unsupported sentry-android version by antonis in #6238
  • chore(deps): update JavaScript SDK to v10.56.0 by github-actions in #6249
  • chore(ci): Pin all GitHub Actions to full commit SHAs by antonis in #6243
  • 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.

Comment thread packages/expo-upload-sourcemaps/cli.js
@antonis antonis added the ready-to-merge Triggers the full CI test suite label Jun 2, 2026
Comment thread packages/core/test/scripts/sentry-cli-resolution.test.ts Outdated
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.

Comment thread packages/expo-upload-sourcemaps/cli.js Outdated
Comment on lines +176 to 177
)
.directory(rootDir)
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.

Thank you for iterating on this @shawnthye-guru 🙇
This should fix the last lint issue 🤞

Suggested change
)
.directory(rootDir)
).directory(rootDir)

Other than that everything LGTM 🚀

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