iosreact-nativesentryreact-native-sentry

Sentry on React Native: Building for iOS breaks with "property 'options' not found on object of type 'PrivateSentrySDKOnly'"


I am using CircleCI to build for iOS (and Android) and recently, the iOS build fails with these error messages:

Compiling RNSentry.m

❌  /Users/distiller/project/node_modules/@sentry/react-native/ios/RNSentry.m:107:79: property 'options' not found on object of type 'PrivateSentrySDKOnly'

    if (appIsActive && !sentHybridSdkDidBecomeActive && (PrivateSentrySDKOnly.options.enableAutoSessionTracking || PrivateSentrySDKOnly.options.enableOutOfMemoryTracking)) {
               ^


❌  /Users/distiller/project/node_modules/@sentry/react-native/ios/RNSentry.m:107:137: property 'options' not found on object of type 'PrivateSentrySDKOnly'

    if (appIsActive && !sentHybridSdkDidBecomeActive && (PrivateSentrySDKOnly.options.enableAutoSessionTracking || PrivateSentrySDKOnly.options.enableOutOfMemoryTracking)) {
                                                                              ^


❌  /Users/distiller/project/node_modules/@sentry/react-native/ios/RNSentry.m:155:39: property 'getSdkName' not found on object of type 'PrivateSentrySDKOnly'

        @"name": PrivateSentrySDKOnly.getSdkName,
                                                                                                                                        ^


❌  /Users/distiller/project/node_modules/@sentry/react-native/ios/RNSentry.m:195:34: property 'options' not found on object of type 'PrivateSentrySDKOnly'

        if (PrivateSentrySDKOnly.options.debug

It has once worked to build for iOS, and I think this has something to do with the version of Sentry; I think I tried to update the Sentry version to 4.9.0, only to find that 4.9.0 has some serious issues (I think). I am not smart enough to decipher exactly what the conclusions here are, but I think it relates:

https://github.com/getsentry/sentry-cocoa/issues/1665 https://github.com/getsentry/sentry-react-native/issues/2530 (I was looking for another URL that related, but can't find now)

Android works to build with the configs and whatnot, but iOS fails. What can I do to resolve this?

The package.json has Sentry 4.8.0:

  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.17.4",
    "@react-native-community/cli-platform-android": "^6.3.0",
    "@sentry/react-native": "4.8.0",
    "@turf/distance": "^6.0.1",
    "axios": "^1.1.1",
    "dotenv": "^16.0.0",
    "eventing-bus": "^2.0.1",
    "jetifier": "^2.0.0",
    "lodash": "^4.17.15",
    "moment": "^2.29.3",
    "moment-timezone": "^0.5.34",
    "patch-package": "^6.4.7",
    "react": "17.0.2",
    "react-native": "0.67.4",

Here is the rest of my config/setup:

PS C:\Github\alfaonlinev3> npx react-native doctor
Common
 ✓ Node.js
 ✓ yarn

Android
 ✓ JDK
 ✖ Android Studio - Required for building and installing your app on Android
 ✓ Android SDK - Required for building and installing your app on Android
 ✓ ANDROID_HOME

Errors:   1
Warnings: 0

Note: I have Android Studio installed, and it is working for Android native project. No idea why doctor complains or how to resolve it, other than downloading another copy of Android studio?

envinfo:
  Visual Studio code: 1.73.1


  System:
    OS: Windows 10 10.0.19044
    CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
    Memory: 5.01 GB / 31.95 GB
  Binaries:
    Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.5.5 - C:\Program Files\nodejs\npm.CMD
  Managers:
    pip2: 19.2.3 - C:\Python27\Scripts\pip2.EXE
    pip3: 21.1.1 - C:\Python39\Scripts\pip3.EXE
  Utilities:
    Git: 2.34.1.
  SDKs:
    Android SDK:
      API Levels: 28, 29, 30, 31, 33
      Build Tools: 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
  IDEs:
    VSCode: 1.73.1 - C:\Program Files\Microsoft VS Code\bin\code.CMD
    Visual Studio: 17.3.32519.111 (Visual Studio Community 2022), 16.11.32106.194 (Visual Studio Community 2019)
  Languages:
    Java: 19.0.1
    Python: 3.9.5
  Databases:
    SQLite: 3.32.2 - C:\Users\wagge\AppData\Local\Android\Sdk\platform-tools\sqlite3.EXE
  Browsers:
    Chrome: 107.0.5304.121
    Edge: Spartan (44.19041.1266.0), Chromium (107.0.1418.56)
    Internet Explorer: 11.0.19041.1566


 IDEs:
    Android Studio: Not Found
    Visual Studio: 17.3.32519.111 (Visual Studio Community 2022), 16.11.32106.194 (Visual Studio Community 2019)
  Languages:
    Java: 19.0.1
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.67.4 => 0.67.4
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

UPDATE

I ran npm-update, it suggested updating sentry to 4.10.1. After that was done, I see this change in package.json:

enter image description here

also yarn.lock

enter image description here

but still, the builds fails with the same error.

UPDATE 2

I check podfile.* and I see stuff like:

 podfile.lock:

  - RNSentry (3.4.2):
    - React-Core
    - Sentry (= 7.11.0)
  - RNSnackbar (2.4.0):
    - React-Core
  - RNSVG (9.13.6):
    - React
  - Sentry (7.11.0):
    - Sentry/Core (= 7.11.0)
  - Sentry/Core (7.11.0)

The file podfile does not contain "sentry" at all.


Solution

  • Looks like it is your problem:

    https://github.com/getsentry/sentry-react-native/pull/2599/files

    Try to upgrade react native sentry to 4.10.1