sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Fingerprint is not set properly

Open HazAT opened this issue 8 years ago • 11 comments

^ title

HazAT avatar May 15 '18 07:05 HazAT

Yes, it is always set to ["{{ default }}"] event when it is passing into Sentry.captureException().

geraintwhite avatar Aug 31 '18 10:08 geraintwhite

@HazAT I am stuck when tried group messages using fingerprint. Could you tell me which is event of react-native-sentry that I can modify log data to add fingerprint attribute ?

nguyenhose avatar Oct 29 '18 13:10 nguyenhose

Can we set the fingerprint in react-native-sentry only with Sentry.configureScope? This does not feel right for only one time changes. Because we only want the modified the fingerprint for one call. This cause to Code like this:

let fingerprint = null;
Sentry.configureScope((scope) => {
  scope.setFingerprint(fingerprint || ['{{default}}']);
});
function specialException(error, tags) {
  fingerprint = tags;
  Sentry.captureException(error);
  fingerprint = null;
}

JBenda avatar Nov 09 '18 15:11 JBenda

@JBenda D you can use like this example for custom sentry catch (crash, exception ... )

export const captureMessage = (message, extra = {}, level = 'warning') => {
  Sentry.captureMessage(message, {
    level,
    extra,
    fingerprint: ['Type: Crash', 'Message: null is not object']
  })
}

nguyenhose avatar Nov 09 '18 18:11 nguyenhose

It seems to be a problem with the native integration (on iOS at least). Disabling it worked for me:

Sentry.config("***", {
  disableNativeIntegration: true
}).install();

function captureException(error, name) {
  Sentry.captureException(error, {
    fingerprint: ["{{ default }}", name]
  });
}

captureException(new Error("404 Not found"), "getUser");
captureException(new Error("404 Not found"), "getSettings");

To get to this conclusion, I followed the instructions here. I was able to verify that even if I manually set the fingerprint via the dataCallback, it never reaches Sentry. You can check if that's the case for you too by looking into the JSON representation of your exception on the Sentry console. In my case, the fingerprint was always set to {{ default }}.

I haven't investigated why this happens though.

maximeaubaret avatar Nov 29 '18 12:11 maximeaubaret

According to release notes this should be fixed in 0.40.2 however upon upgrading, the fingerprint seems to be sent on Android, but not on iOS. Does anything extra needs to be configured for it to work on iOS? We've updated the library, unlinked and linked react-native-sentry again, and re-added the framework/library in XCode, it hasn't changed anything :(

llostris avatar Dec 20 '18 15:12 llostris

FYI @llostris @maximeaubaret et al., I think I've got a fix for this over at https://github.com/getsentry/sentry-cocoa/pull/279. Certainly explains why disabling the native integration did the trick for you!

For anyone else scratching their head over this before it makes it into a release, it's easy to make the one line change directly in your Pods directory (for @CocoaPods users), or using e.g., [patch-package(https://github.com/ds300/patch-package)] if not.

jessestuart avatar Jan 08 '19 23:01 jessestuart

@HazAT Any chance of getting that fix released?

llostris avatar Jan 15 '19 14:01 llostris

@llostris It's been merged into master in sentry-cocoa — I've submitted another PR with a version bump to trigger a release: https://github.com/getsentry/sentry-cocoa/pull/281

The last step will be to simply update this repo's podspec to point to the patched version of sentry-cocoa. (cc @HazAT)

jessestuart avatar Jan 15 '19 16:01 jessestuart

Release 0.40.3 going out now, closing this for now.

HazAT avatar Jan 17 '19 15:01 HazAT

Thanks again for the quick turnaround @HazAT! 👍

jessestuart avatar Jan 17 '19 19:01 jessestuart