rollbar / rollbar-react-native

Crash and error reporting for React Native using Rollbar
https://docs.rollbar.com/docs/react-native
62 stars 37 forks source link

Unrecognized selector error #178

Closed jbennett closed 11 months ago

jbennett commented 1 year ago

I am getting an unrecognized selector error being sent to [RollbarDestination setAccessToken:] on iOS. This looks like it it happening if I update the configuration, which is happening if I have setup the native and JS clients.

My objective-c is super rusty, but in RollbarReactNative.m, in the init (line 377), when it casts the [Rollbar configuration] to a RollbarMutableConfig, does this make the destination mutable as well?

feng-yu-healthbank commented 1 year ago

I am having the same issue on ios, when upgrading rollbar-react-native to 1.0.0.

The Android version is having no problem at all.

Environment:

System:
    OS: macOS 13.5.2
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 27.61 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.15.0 - /usr/local/opt/node@18/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.5.0 - /usr/local/opt/node@18/bin/npm
    Watchman: 2023.03.27.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.1 AI-221.6008.13.2211.9514443
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.6 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    "react": "18.2.0",
    "react-native": "0.71.4",
    "expo": "^48.0.9",
    "rollbar": "^2.26.2",
    "rollbar-react-native": "^1.0.0-beta.0",
    "@rollbar/react": "^0.11.2",
  npmGlobalPackages:
    *react-native*: Not Found

The error:

2023-09-12 18:22:43.163800+1000 HealthBank[3757:35178] [native] Exception '-[RollbarDestination setAccessToken:]: unrecognized selector sent to instance 0x600003b60a80' was thrown while invoking init on target RollbarReactNative with params (
        {
        accessToken = ***************;
        captureDeviceInfo = 1;
        captureUncaught = 1;
        captureUnhandledRejections = 1;
        environment = development;
        notifier =         {
            name = "rollbar-react-native";
            version = "1.0.0-beta.0";
        };
        payload =         {
            client =             {
                os =                 {
                    "app_name" = **********;
                    "bundle_identifier" = "***************";
                    "code_version" = 1;
                    "device_code" = "x86_64";
                    "device_name" = "iPhone 14";
                    os = ios;
                    "os_version" = "16.4";
                    "short_version" = "1.9.8";
                    "system_name" = iOS;
                };
            };
        };
        platform = ios;
    }
)
callstack: (
    0   CoreFoundation                      0x000000011df8a78b __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00000001142dcb73 objc_exception_throw + 48
    2   CoreFoundation                      0x000000011df998c4 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
    3   CoreFoundation                      0x000000011df8ec66 ___forwarding___ + 1443
    4   CoreFoundation                      0x000000011df90e08 _CF_forwarding_prep_0 + 120
    5   HealthBank                          0x000000010bd72bc6 updateConfiguration + 246
    6   HealthBank                          0x000000010bd75534 -[RollbarReactNative init:] + 100
    7   CoreFoundation                      0x000000011df9109c __invoking___ + 140
    8   CoreFoundation                      0x000000011df8e406 -[NSInvocation invoke] + 305
    9   CoreFoundation                      0x000000011df8e6a5 -[NSInvocation invokeWithTarget:] + 70
    10  HealthBank                          0x000000010bc1d022 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2498
    11  HealthBank                          0x000000010bc21afb _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 2043
    12  HealthBank                          0x000000010bc21145 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 133
    13  HealthBank                          0x000000010bc210b9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
    14  libdispatch.dylib                   0x00000001203f654f _dispatch_call_block_and_release + 12
    15  libdispatch.dylib                   0x00000001203f77ec _dispatch_client_callout + 8
    16  libdispatch.dylib                   0x00000001203ff6ae _dispatch_lane_serial_drain + 1115
    17  libdispatch.dylib                   0x00000001204004a6 _dispatch_lane_invoke + 428
    18  libdispatch.dylib                   0x000000012040e982 _dispatch_workloop_worker_thread + 962
    19  libsystem_pthread.dylib             0x0000000121126c55 _pthread_wqthread + 327
    20  libsystem_pthread.dylib             0x0000000121125bbf start_wqthread + 15
)

Another error when calling setPerson:

2023-09-12 18:22:44.199331+1000 HealthBank[3757:35178] [native] Exception '-[RollbarConfig setPersonId:username:email:]: unrecognized selector sent to instance 0x600002ebd680' was thrown while invoking setPerson on target RollbarReactNative with params (
        {
        id = "";
    }
)
callstack: (
    0   CoreFoundation                      0x000000011df8a78b __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00000001142dcb73 objc_exception_throw + 48
    2   CoreFoundation                      0x000000011df998c4 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
    3   CoreFoundation                      0x000000011df8ec66 ___forwarding___ + 1443
    4   CoreFoundation                      0x000000011df90e08 _CF_forwarding_prep_0 + 120
    5   HealthBank                          0x000000010bd75c36 -[RollbarReactNative setPerson:] + 1510
    6   CoreFoundation                      0x000000011df9109c __invoking___ + 140
    7   CoreFoundation                      0x000000011df8e406 -[NSInvocation invoke] + 305
    8   CoreFoundation                      0x000000011df8e6a5 -[NSInvocation invokeWithTarget:] + 70
    9   HealthBank                          0x000000010bc1d022 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2498
    10  HealthBank                          0x000000010bc21afb _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 2043
    11  HealthBank                          0x000000010bc21145 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 133
    12  HealthBank                          0x000000010bc210b9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
    13  libdispatch.dylib                   0x00000001203f654f _dispatch_call_block_and_release + 12
    14  libdispatch.dylib                   0x00000001203f77ec _dispatch_client_callout + 8
    15  libdispatch.dylib                   0x00000001203ff6ae _dispatch_lane_serial_drain + 1115
    16  libdispatch.dylib                   0x00000001204004a6 _dispatch_lane_invoke + 428
    17  libdispatch.dylib                   0x000000012040e982 _dispatch_workloop_worker_thread + 962
    18  libsystem_pthread.dylib             0x0000000121126c55 _pthread_wqthread + 327
    19  libsystem_pthread.dylib             0x0000000121125bbf start_wqthread + 15
)

Sample minimal reproduction repository

https://github.com/feng-yu-healthbank/AwesomeProject

Please note:

How to reproduce:

clone repo
cd repo
npm install
cd ios
pod install

Open repo/ios with Xcode and run it on the "iPhone 14" emulator.

Expected The app launches and successfully sends "Hello World" to Rollbar.

Actual The app throws a critical error. When released as a standalone app, it would crash on launch.

image

jbennett commented 1 year ago

@feng-yu-healthbank I submitted a PR (#179) that fixes this issue. Can you config if that works for you too?

waltjones commented 11 months ago

@jbennett fix released in v1.0.0-beta.1.

feng-yu-healthbank commented 11 months ago

@feng-yu-healthbank I submitted a PR (#179) that fixes this issue. Can you config if that works for you too?

Sorry I was busy with a production release of my app. I didn't look into it since I reverted rollbar to an earlier version

brianr commented 11 months ago

Hi all, this should be fixed with https://github.com/rollbar/rollbar-react-native/releases/tag/v1.0.0-beta.1 . Thanks @jbennett for the PR! All, let us know if there's still an issue here.