Skip to content

[iOS, Xcode] Automatic source map upload is not working in RN 0.75.x #4074

@LydGol90

Description

@LydGol90

Important

To fix the automatic upload in 0.75 please add the following to your Bundle React Native code and image Build Phase:

set -e

+export BUNDLE_COMMAND="bundle"

WITH_ENVIRONMENT="$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="$REACT_NATIVE_PATH/scripts/react-native-xcode.sh"

/bin/sh -c "$WITH_ENVIRONMENT \"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh >$REACT_NATIVE_XCODE\""

For more detail see #4074 (comment)

Description

Hi there,

I am having trouble with ios source maps.

I followed the manual set up here:
https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/

I added SOURCEMAP_FILE as RN docs imply that is required to enable sourcemaps at all for ios
https://reactnative.dev/docs/debugging-release-builds#enabling-source-maps

This is my "Bundle React Native code and images" script:

export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map";
export SOURCE_MAP_PATH="$DERIVED_FILE_DIR/main.jsbundle.map";

set -e

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
SENTRY_XCODE="../node_modules/@sentry/react-native/scripts/sentry-xcode.sh"
BUNDLE_REACT_NATIVE="/bin/sh $SENTRY_XCODE $REACT_NATIVE_XCODE"

/bin/sh -c "$WITH_ENVIRONMENT \"$BUNDLE_REACT_NATIVE\""

I have a sentry.properties file at the correct location.

I also added the script for "Upload Debug Symbols to Sentry"

This is what I see in Sentry for a JS crash:
Image
Image

Are there additional steps that I am missing? I see there is more documentation around Hermes and around using the fastlane plugin but I'm not clear if those are additional steps or alternative steps.

react-native info:

  OS: macOS 14.6.1
  CPU: (12) arm64 Apple M2 Max
  Memory: 101.63 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.10.0
    path: ~/.nvm/versions/node/v20.10.0/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.nvm/versions/node/v20.10.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v20.10.0/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/lydiagolland/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2412.12266719
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /opt/homebrew/opt/openjdk@17/bin/javac
  Ruby:
    version: 3.1.4
    path: /Users/lydiagolland/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.2
    wanted: 0.75.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

FYI I followed the android instructions from the same docs and that is all working fine.

Many thanks for any help!

Metadata

Metadata

Labels

Projects

Status

Done

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions