Giter Site home page Giter Site logo

Comments (5)

luqas11 avatar luqas11 commented on July 24, 2024 1

Hi @mikehardy! Thanks for the quick response.

It appears that your deduction was right. I took the Crashlytics quickstart project, duplicated the crash button, and added the error attributes:

struct CrashButtonView: View {
  var body: some View {
    NavigationView {
        VStack {
            Button(action: {
                let crashlyticsReference = Crashlytics.crashlytics()
                crashlyticsReference.setCustomValue("value1", forKey: "some_attribute")
                crashlyticsReference.setCustomValue("value", forKey: "another_attribute")
                let error = NSError(domain: NSURLErrorDomain, code: -1001, userInfo: nil)
                Crashlytics.crashlytics().record(error: error)
            }) {
                Text("Send Error 1")
            }
            Button(action: {
                let crashlyticsReference = Crashlytics.crashlytics()
                crashlyticsReference.setCustomValue("value2", forKey: "some_attribute")
                let error = NSError(domain: NSURLErrorDomain, code: -1002, userInfo: nil)
                Crashlytics.crashlytics().record(error: error)
            }) {
                Text("Send Error 2")
            }
        }
      .navigationTitle("Crashlytics Example")
    }
  }
}

And, after repeating the experiment, I can see that the bug persists:

For Error 1:

image

For Error 2:

image

Both reports have some_attribute set to value2, despite its being set to value1 for the first one. I will open an issue at firebase-ios-sdk and wait for their response.

Thanks again for the analysis!

from react-native-firebase.

luqas11 avatar luqas11 commented on July 24, 2024 1

Here is the firebase-sdk-ios issue that I created, for future reference: firebase/firebase-ios-sdk#13124

from react-native-firebase.

mikehardy avatar mikehardy commented on July 24, 2024 1

Reproductions like you've done are worth more than all the words I can put in a comment box, so your effort is the real motive force here, thanks for pursuing it upstream and hopefully there's a quick resolution - cheers

from react-native-firebase.

mikehardy avatar mikehardy commented on July 24, 2024

Interesting -

1- javascript implementation is here, does some basic argument validation then defers immediately to native:

setAttribute(name, value) {
if (!isString(name)) {
throw new Error(
'firebase.crashlytics().setAttribute(*, _): The supplied property name must be a string.',
);
}
if (!isString(value)) {
throw new Error(
'firebase.crashlytics().setAttribute(_, *): The supplied property value must be a string value.',
);
}
return this.native.setAttribute(name, value);
}

2- java implementation similarly does a basic validation that crashlytics is enabled at all, then delegates immediately to firebase-android-sdk:

@ReactMethod
public void setAttribute(String key, String value, Promise promise) {
if (ReactNativeFirebaseCrashlyticsInitProvider.isCrashlyticsCollectionEnabled()) {
FirebaseCrashlytics.getInstance().setCustomKey(key, value);
}
promise.resolve(null);
}

3- objective-c also just verifies that crashlytics is enabled then sets the attribute via immediate delegate call to firebase-ios-sdk method:

RCT_EXPORT_METHOD(setAttribute
: (NSString *)key value
: (NSString *)value resolver
: (RCTPromiseResolveBlock)resolve rejecter
: (RCTPromiseRejectBlock)reject) {
if ([RNFBCrashlyticsInitProvider isCrashlyticsCollectionEnabled]) {
[[FIRCrashlytics crashlytics] setCustomValue:value forKey:key];
}
resolve([NSNull null]);
}

By deduction: one of the attributes from report 1 or report 2 would be missing if the argument validation logic or crashlytics enabled verification logic were false, but the attributes are both set (and incorrectly mingled on iOS) so we may infer that we are definitely calling into firebase-ios-sdk with the setAttribute calls

Given there is nothing else happening in this layer of the stack, I think this points to an issue in firebase-ios-sdk

I believe the best next step is to make a similar reproduction using the Crashlytics quickstart https://github.com/firebase/quickstart-ios/tree/main/crashlytics and logging an issue in firebase-ios-sdk repo pointing at the issue there as I think that's where the fault is located

Note especially that if you run the quickstart app under Xcode there is a debugger attached which interferes with Crashlytics: https://github.com/firebase/quickstart-ios/tree/main/crashlytics#trigger-a-crash-in-crashlytics-quickstart-app - this causes a lot of confusion sometimes. You have to launch it manually, not under Xcode

Adding the setAttributes calls (and another crash button) is hopefully a trivial extension to the quickstart so the repro is fast - there is example code included in my code permalinks above

from react-native-firebase.

github-actions avatar github-actions commented on July 24, 2024

Hello πŸ‘‹, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

from react-native-firebase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.