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

WITH_ENVIRONMENT no longer obeyed in monorepos for Xcode scripts bundled with Sentry RN SDK #761

Open
liamjones opened this issue Jan 16, 2025 · 0 comments

Comments

@liamjones
Copy link
Contributor

Environment

RN 0.74.6 in a mono repo w/ @sentry/react-native 5.35.0 & Volta managing Node versions (configured properly in .xcode.env)

Steps to Reproduce

  1. Updated app from RN SDK 5.22.2 to 5.35.0 (or used the latest wizard to integrate the RN SDK into an app in a mono repo with node-modules/react-native hoisted above the app directory)
  2. Run build in Xcode

Expected Result

Build works

Actual Result

"Bundle React Native code and images" build phase correctly obeys the .xcode.env and find Node via Volta.
"Upload Debug Symbols to Sentry" build phase fails, stating it can't find Node (it hasn't obeyed .xcode.env).

PR #329 added support for WITH_ENVIRONMENT in the Sentry scripts to work better in mono repos. It looks like PR #499 broke this when the scripts started being bundled with the RN SDK.

I've patched this locally but I don't have time to raise PRs for the Wizard & Docs right now, sorry: 🙏

  1. export function addDebugFilesUploadPhaseWithBundledScripts(
    doesn't setup WITH_ENVIRONMENT before it calls the script so the https://github.com/getsentry/sentry-react-native/blob/1d15d81ffed8204943b29404d66ab45bbe1154dd/scripts/sentry-xcode-debug-files.sh#L8 check will never be true.
  2. The fallback in https://github.com/getsentry/sentry-react-native/blob/1d15d81ffed8204943b29404d66ab45bbe1154dd/scripts/sentry-xcode-debug-files.sh#L8 could potentially be using $REACT_NATIVE_PATH to make it more mono-repo friendly but I think will still fail due to the lack of sourcing WITH_ENVIRONMENT.

What I've done for now is update the "Upload Debug Symbols to Sentry" phase to the following:

set -e

export WITH_ENVIRONMENT="$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"

/bin/sh ../../../../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh

An inconsistency I noticed; that the "Bundle React Native code and images" script calls with-environment.sh directly before the RN/Sentry script. The way sentry-xcode-debug-files.sh is written, it expects to source the file itself.

Another inconsistency I noticed, but this may be correct, the Bundle phase has input files .xcode.env and .xcode.env.local as Input Files in the Xcode UI but the Upload debug symbols phase doesn't.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Product Owner
Development

No branches or pull requests

1 participant