sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

App Crash in React Native - [__NSDictionaryM setObject:forKey:]: key cannot be nil

Open himujs opened this issue 1 year ago • 9 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

7.102.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

As soon as I open my React Native app it gives an error -

Error Details the issue in finding the setObject:forKey: in Container+SentryDeepSearch.m (path - pods/sentry/sources/SentryCrash/Reporting. It might be due to the updates in the dependency of the sentry.

Expected Result

It was working fine until yesterday.

Actual Result

image

himujs avatar Feb 22 '24 06:02 himujs

Hey @HimanshuRstar thanks for writing in!

According to the issue description you're using @sentry/react. Can you confirm that this is the SDK you're using or are you using @sentry/react-native? Just trying to figure out where to route this issue to ;)

Lms24 avatar Feb 22 '24 08:02 Lms24

Hey Lukas,

My bad, we are using @sentry/react-native in our Application.

Thanks, Himanshu


From: Lukas Stracke @.> Sent: Thursday, February 22, 2024 1:59 PM To: getsentry/sentry-javascript @.> Cc: Himanshu Kathuria @.>; Mention @.> Subject: [External]Re: [getsentry/sentry-javascript] App Crash in React Native - [__NSDictionaryM setObject:forKey:]: key cannot be nil (Issue getsentry/sentry-cocoa#3681)

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Hey @HimanshuRstarhttps://github.com/HimanshuRstar thanks for writing in!

According to the issue description you're using @sentry/react. Can you confirm that this is the SDK you're using or are you using @sentry/react-native? Just trying to figure out where to route this issue to ;)

— Reply to this email directly, view it on GitHubhttps://github.com/getsentry/sentry-cocoa/issues/3681, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYRRFH2GRU6UGSY5MGW2OPTYU36XXAVCNFSM6AAAAABDULUGNKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJYHE2DAOJYGQ. You are receiving this because you were mentioned.Message ID: @.***>

himujs avatar Feb 22 '24 09:02 himujs

No worries all good! I'm just gonna transfer this issue to the React Native SDK repo and tag @krystofwoldrich to please take a look. Thanks!

Lms24 avatar Feb 22 '24 09:02 Lms24

Thanks @Lms24. Appreciate it!

himujs avatar Feb 22 '24 09:02 himujs

Hey @himujs can you share the versions of @sentry/react-native and React Native you're using? Also you're indicating that you updated versions/dependencies recently, and that it worked until your change, is that correct? Which versions did you use before that worked?

kahest avatar Feb 22 '24 12:02 kahest

Sure @kahest.

So we were earlier using "@sentry/react-native": "^4.13.0" and "react-native": "0.71.11".

This was working fine until yesterday. But it started giving this error - [__NSDictionaryM setObject:forKey:]: key cannot be nil resulting in an app crash either on app start up or after logging in.

We tried upgrading the sentry/react-native to 5.19.0 which is the latest right now but still no luck.

After completely disabling the sentry from our App.tsx and our utility file, we didn't encounter any crashes.

Not sure if it'll help but a similar issue was opened in 2021 - getsentry/sentry-react-native#1367

himujs avatar Feb 22 '24 13:02 himujs

Also, we are not using setObjectForKey anywhere in the application. It was only found in deepsearch in sentry - setObject:forKey: in Container+SentryDeepSearch.m.

Hope it helps for more context. 😄

himujs avatar Feb 22 '24 13:02 himujs

This is the mentioned code, but the particular piece has not changed in years.

https://github.com/getsentry/sentry-cocoa/blob/3f74b8f54bbec9bf8de8babc09a56229f4e23b3f/Sources/SentryCrash/Reporting/Filters/Tools/Container%2BSentryDeepSearch.m#L109

@himujs Can you share the stack trace of the error?

@philipphofmann @brustolin Based on the current information do you have any thoughts?

krystofwoldrich avatar Feb 23 '24 12:02 krystofwoldrich

I have no clue what could be causing this, but the Cocoa SDK causes it. I'm moving this to the sentry-cocoa repository.

philipphofmann avatar Feb 26 '24 13:02 philipphofmann