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

[iOS] No matching Debug IDs found for JS sourcemaps. #4355

Open
jayshah123 opened this issue Dec 11, 2024 · 4 comments
Open

[iOS] No matching Debug IDs found for JS sourcemaps. #4355

jayshah123 opened this issue Dec 11, 2024 · 4 comments

Comments

@jayshah123
Copy link

jayshah123 commented Dec 11, 2024

Image

What React Native libraries do you use?

Hermes, React Navigation, Expo (mobile only) with Bare workflow

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

5.33.0

How does your development environment look like?

JS stacktrace shows "Unminify code" (See screenshot below)

https://people-center-inc.sentry.io/issues/5949546316/?project=1272927&query=release%3A3.0.3-1008&referrer=issue-stream&sort=freq&statsPeriod=7d&stream_index=1

System:
OS: macOS 15.1.1
CPU: (10) arm64 Apple M1 Max
Memory: 185.14 MB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.13.0
path: ~/.nvm/versions/node/v18.13.0/bin/node
Yarn:
version: 1.18.0
path: ~/.yarn/bin/yarn
npm:
version: 8.19.3
path: ~/.nvm/versions/node/v18.13.0/bin/npm
Watchman:
version: 2024.10.21.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.14.3
path: /Users/jshah/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.0
- iOS 18.0
- macOS 15.0
- tvOS 18.0
- visionOS 2.0
- watchOS 11.0
Android SDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10811636
Xcode:
version: 16.0/16A242d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /usr/bin/javac
Ruby:
version: 3.3.0
path: /Users/jshah/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.9
wanted: 0.73.9
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Sentry.init()

 Sentry.init({
    dsn: SENTRY_DSN,
    environment: ENVIRONMENT,
    release: `${appJson.expo.version}-${appJson.expo.jsVersion}`,
    dist: `${appJson.expo.versionCode}`,
    beforeSend: sentryFilter,
    enableTracing: false,
    attachStacktrace: true,
    enableWatchdogTerminationTracking: true,
    enableAutoPerformanceTracing: false,
    integrations: [new ExecutionNamespaceIntegration()],
  });

Steps to Reproduce

  1. We use Bare workflow with Expo core sdk.
  2. Build and release iOS app
    I have "Bundle React Native Code and images" with following code (updated with sentry wizard codegen):
if [ "$CI" != true ]; then 
 ~/.nvm/nvm.sh 
fi 
if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then
  source "$PODS_ROOT/../.xcode.env"
fi
if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
  source "$PODS_ROOT/../.xcode.env.local"
fi

# The project root by default is one level up from the ios directory
export PROJECT_ROOT="$PROJECT_DIR"/..

if [[ "$CONFIGURATION" = *Debug* ]]; then
  export SKIP_BUNDLING=1
fi
if [[ -z "$ENTRY_FILE" ]]; then
  # Set the entry JS file using the bundler's entry resolution.
  export ENTRY_FILE="$("$NODE_BINARY" -e "require('expo/scripts/resolveAppEntry')" "$PROJECT_ROOT" ios relative | tail -n 1)"
fi

if [[ -z "$CLI_PATH" ]]; then
  # Use Expo CLI
  export CLI_PATH="$("$NODE_BINARY" --print "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })")"
fi
if [[ -z "$BUNDLE_COMMAND" ]]; then
  # Default Expo CLI command for bundling
  export BUNDLE_COMMAND="export:embed"
fi

# Source .xcode.env.updates if it exists to allow
# SKIP_BUNDLING to be unset if needed
if [[ -f "$PODS_ROOT/../.xcode.env.updates" ]]; then
  source "$PODS_ROOT/../.xcode.env.updates"
fi
# Source local changes to allow overrides
# if needed
if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
  source "$PODS_ROOT/../.xcode.env.local"
fi

# Uncomment folowing line to run expo-updates with debug build
#sed -i '' 's/SKIP_BUNDLING/FORCE_BUNDLING/g;' ios/<project name>.xcodeproj/project.pbxproj

export NODE_ARGS="--max-old-space-size=8192"

/bin/sh `"$NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'"` `"$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'"`

Expected Result

Should work as expected.
I believe the sourcemaps might not have been uploaded, can we make these steps have more verbose logging to debug quicker?

Actual Result

Image

@jayshah123
Copy link
Author

jayshah123 commented Dec 11, 2024

Another issue, why is this script sentry-xcode.sh running in debug builds?
Is there a recommendation to skip it for Debug Builds?

Is there a way to know if sentry's script invoked react-native-xcode.sh or not?
This is crucial to know as it does a bunch of stuff:

  1. IP address detection for device.
  2. bundle command and hermes
  3. sourcemap composition etc.

@jayshah123
Copy link
Author

jayshah123 commented Dec 12, 2024

I uploaded it manually for now by writing below script,
I was wondering about following (Let me know if it makes sense):

  1. Revert sentry stuff from "Bundle React Native Code and Images"
  2. Use below script as a one more extra Build script phase? (I got it from the docs here - https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo-advanced/
#!/bin/bash

set -ex

npx expo export:embed \
  --entry-file index.js \
  --platform ios \
  --dev false \
  --reset-cache \
  --bundle-output main.jsbundle \
  --sourcemap-output main.jsbundle.map

ios/Pods/hermes-engine/destroot/bin/hermesc \
  -O -emit-binary \
  -output-source-map \
  -out=main.jsbundle.hbc \
  main.jsbundle
rm -f main.jsbundle
mv main.jsbundle.hbc main.jsbundle

mv main.jsbundle.map main.jsbundle.packager.map
node \
  node_modules/react-native/scripts/compose-source-maps.js \
  main.jsbundle.packager.map \
  main.jsbundle.hbc.map \
  -o main.jsbundle.map
node \
  node_modules/@sentry/react-native/scripts/copy-debugid.js \
  main.jsbundle.packager.map main.jsbundle.map
rm -f main.jsbundle.packager.map

npx sentry-cli sourcemaps upload \
  --debug-id-reference \
  --strip-prefix /path/to/project/root \
  main.jsbundle main.jsbundle.map

@krystofwoldrich
Copy link
Member

Hi @jayshah123,
thank you for the meassage.

Another issue, why is this script sentry-xcode.sh running in debug builds?
Sentry automatically uploads the source maps only for release builds, to do so we wrap the react-native-xcode.sh script. By wrapping the RN script we are able to dynamically resolved the bundle and source maps paths. When CONFIGURATION env contains Debug the Sentry CLI does nothing and executes the RN script.

Is there a way to know if sentry's script invoked react-native-xcode.sh or not?
Yes, the same as without Sentry. The Xcode build logs will contain the Metro Packager and Hermes Compiler output based on which you can confirm that bundle and source map were created.

I was wondering about following (Let me know if it makes sense):
If the manual script work for your scenario you can execute it in a custom build phase. And remove the changes from Bundle React Native Code.... Ensure source maps are still generated, add export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map".


We are happy to investigate more, why the automatic upload didn't work for you.

Could you please send us output of the Bundle React Native Code and Images build phase from a Release build?

@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 3 Dec 12, 2024
@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Dec 12, 2024
@jayshah123
Copy link
Author

jayshah123 commented Dec 13, 2024

Here are the build logs, let me know if you need anyting more (app name replaced to myapp here for anonymity):

[11:54:33]: ▸ �[35m[�[36mmyapp�[0m] �[1mRunning script�[0m Bundle React Native code and images�[0m
[11:55:38]: ▸ �[35m⚠️ �[33mnot stripping binary because it is signed: /Users/vagrant/Library/Developer/Xcode/DerivedData/myapp-fgtazkdgdtwgobggafudqccdhlyl/Build/Intermediates.noindex/ArchiveIntermediates/myapp/BuildProductsPath/Release-iphoneos/../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/autofill-extension.appex/autofill-extension (in target 'myapp' from project 'myapp')�[0m
[11:55:38]: ▸ �[35m⚠️ �[33mnot stripping binary because it is signed: /Users/vagrant/Library/Developer/Xcode/DerivedData/myapp-fgtazkdgdtwgobggafudqccdhlyl/Build/Intermediates.noindex/ArchiveIntermediates/myapp/BuildProductsPath/Release-iphoneos/../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension (in target 'myapp' from project 'myapp')�[0m
[11:55:38]: ▸ �[35m[�[36mmyapp�[0m] �[1mProcessing�[0m Info.plist�[0m
[11:55:38]: ▸ �[35m[�[36mmyapp�[0m] �[1mRunning script�[0m [CP] Embed Pods Frameworks�[0m
[11:55:39]: ▸ �[35m[�[36mmyapp�[0m] �[1mGenerating�[0m myapp.app.dSYM�[0m
[11:55:47]: ▸ �[35m[�[36mmyapp�[0m] �[1mRunning script�[0m [CP] Copy Pods Resources�[0m
[11:55:47]: ▸ �[35m[�[36mmyapp�[0m] �[1mRunning script�[0m Upload Debug Symbols to Sentry�[0m
[11:55:47]: ▸ �[35m�[1mSigning�[0m myapp.app (in target 'myapp' from project 'myapp')�[0m
[11:55:48]: ▸ �[35m[�[36mmyapp�[0m] �[1mTouching�[0m myapp.app�[0m
[11:55:49]: ▸ �[35m�[32;1mArchive Succeeded�[0m
[11:55:49]: �[33mGenerated plist file with the following values:�[0m
[11:55:49]: ▸ �[35m-----------------------------------------�[0m
[11:55:49]: ▸ �[35m{�[0m
[11:55:49]: ▸ �[35m  "method": "app-store",�[0m
[11:55:49]: ▸ �[35m  "signingStyle": "manual",�[0m
[11:55:49]: ▸ �[35m  "provisioningProfiles": {�[0m
[11:55:49]: ▸ �[35m    "com.people.myapp": "match AppStore com.people.myapp",�[0m
[11:55:49]: ▸ �[35m    "com.people.myapp.autofill-extension": "match AppStore com.people.myapp.autofill-extension",�[0m
[11:55:49]: ▸ �[35m    "com.people.myapp.OneSignalNotificationServiceExtension": "match AppStore com.people.myapp.OneSignalNotificationServiceExtension"�[0m
[11:55:49]: ▸ �[35m  }�[0m
[11:55:49]: ▸ �[35m}�[0m
[11:55:49]: ▸ �[35m-----------------------------------------�[0m
[11:55:49]: �[36m$ /usr/bin/xcrun /Users/vagrant/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/fastlane-2.219.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/7l/rszmbrmd6tv4pg52z6ql_5rc0000gn/T/gym_config20241210-82242-z1ycn3.plist' -archivePath /Users/vagrant/Library/Developer/Xcode/Archives/2024-12-10/myapp\ 2024-12-10\ 11.47.36.xcarchive -exportPath '/var/folders/7l/rszmbrmd6tv4pg52z6ql_5rc0000gn/T/gym_output20241210-82242-93tws6'  �[0m
[11:55:58]: Compressing 5 dSYM(s)
[11:55:58]: �[36m$ cd '/Users/vagrant/Library/Developer/Xcode/Archives/2024-12-10/myapp 2024-12-10 11.47.36.xcarchive/dSYMs' && zip -r '/Users/vagrant/git/fastlane/builds/myapp.app.dSYM.zip' *.dSYM�[0m
[11:56:04]: ▸ �[35m  adding: LogRocket.framework.dSYM/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: LogRocket.framework.dSYM/Contents/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: LogRocket.framework.dSYM/Contents/Resources/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: LogRocket.framework.dSYM/Contents/Resources/Relocations/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: LogRocket.framework.dSYM/Contents/Resources/Relocations/aarch64/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: LogRocket.framework.dSYM/Contents/Resources/Relocations/aarch64/LogRocket.yml (deflated 88%)�[0m
[11:56:04]: ▸ �[35m  adding: LogRocket.framework.dSYM/Contents/Resources/DWARF/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: LogRocket.framework.dSYM/Contents/Resources/DWARF/LogRocket (deflated 73%)�[0m
[11:56:04]: ▸ �[35m  adding: LogRocket.framework.dSYM/Contents/Info.plist (deflated 52%)�[0m
[11:56:04]: ▸ �[35m  adding: OneSignalNotificationServiceExtension.appex.dSYM/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OneSignalNotificationServiceExtension.appex.dSYM/Contents/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OneSignalNotificationServiceExtension.appex.dSYM/Contents/Resources/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OneSignalNotificationServiceExtension.appex.dSYM/Contents/Resources/Relocations/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OneSignalNotificationServiceExtension.appex.dSYM/Contents/Resources/Relocations/aarch64/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OneSignalNotificationServiceExtension.appex.dSYM/Contents/Resources/Relocations/aarch64/OneSignalNotificationServiceExtension.yml (deflated 74%)�[0m
[11:56:04]: ▸ �[35m  adding: OneSignalNotificationServiceExtension.appex.dSYM/Contents/Resources/DWARF/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OneSignalNotificationServiceExtension.appex.dSYM/Contents/Resources/DWARF/OneSignalNotificationServiceExtension (deflated 59%)�[0m
[11:56:04]: ▸ �[35m  adding: OneSignalNotificationServiceExtension.appex.dSYM/Contents/Info.plist (deflated 51%)�[0m
[11:56:04]: ▸ �[35m  adding: OpenTelemetryApi.framework.dSYM/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OpenTelemetryApi.framework.dSYM/Contents/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OpenTelemetryApi.framework.dSYM/Contents/Resources/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OpenTelemetryApi.framework.dSYM/Contents/Resources/DWARF/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: OpenTelemetryApi.framework.dSYM/Contents/Resources/DWARF/OpenTelemetryApi (deflated 71%)�[0m
[11:56:04]: ▸ �[35m  adding: OpenTelemetryApi.framework.dSYM/Contents/Info.plist (deflated 52%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Resources/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Resources/Relocations/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Resources/Relocations/aarch64/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Resources/Relocations/aarch64/myapp.yml (deflated 88%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Resources/DWARF/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Resources/DWARF/myapp (deflated 74%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Resources/Swift/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Resources/Swift/aarch64/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Resources/Swift/aarch64/OpenTelemetryApi.swiftinterface (deflated 88%)�[0m
[11:56:04]: ▸ �[35m  adding: myapp.app.dSYM/Contents/Info.plist (deflated 52%)�[0m
[11:56:04]: ▸ �[35m  adding: autofill-extension.appex.dSYM/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: autofill-extension.appex.dSYM/Contents/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: autofill-extension.appex.dSYM/Contents/Resources/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: autofill-extension.appex.dSYM/Contents/Resources/Relocations/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: autofill-extension.appex.dSYM/Contents/Resources/Relocations/aarch64/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: autofill-extension.appex.dSYM/Contents/Resources/Relocations/aarch64/autofill-extension.yml (deflated 86%)�[0m
[11:56:04]: ▸ �[35m  adding: autofill-extension.appex.dSYM/Contents/Resources/DWARF/ (stored 0%)�[0m
[11:56:04]: ▸ �[35m  adding: autofill-extension.appex.dSYM/Contents/Resources/DWARF/autofill-extension (deflated 63%)�[0m
[11:56:04]: ▸ �[35m  adding: autofill-extension.appex.dSYM/Contents/Info.plist (deflated 51%)�[0m

[11:56:04]: �[32mSuccessfully exported and compressed dSYM file�[0m
[11:56:04]: �[32mSuccessfully exported and signed the ipa file:�[0m
[11:56:04]: /Users/vagrant/git/fastlane/builds/myapp.ipa

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Product Owner
Status: Needs More Information
Development

No branches or pull requests

2 participants