-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔥 [🐛] setUserId(null) does not work #4931
Comments
Focusing on setUserId: I don't see where in the API that we attempt to mirror exactly (the Firebase JS API) setting a null is supposed to do anything? https://firebase.google.com/docs/reference/js/firebase.analytics.Analytics#setuserid ...but that could be a documentation issue, to travel deeper you may follow the information "Use gtag 'config' command to set 'user_id'" and see that even in the deeper information there is no mention of clearing a value https://developers.google.com/analytics/devguides/collection/ga4/persistent-values I do see how the native APIs allow a null to unset per their documentation: ...widening scope back out to look at User Properties, the native SDKs also seem to indicate that clearing is possible (though the JS API is again quiet on the subject) So: it looks like it's possible Have you examined in the code here (you can just reach right into node_modules That's the next step, and if there is anything to repair there I would happily merge a PR if you posted one up! |
Actually a quick scan of the code indicates it is allowing nulls through:
I believe the native code then will handle the null correctly if it is allowed to pass, calling the firebase SDKs correctly: Lines 62 to 87 in d6f52ca
react-native-firebase/packages/analytics/ios/RNFBAnalytics/RNFBAnalyticsModule.m Lines 70 to 114 in d6f52ca
The tests even appear to be specifically checking to make sure nulls are usable react-native-firebase/packages/analytics/e2e/analytics.e2e.js Lines 61 to 89 in d6f52ca
So I'm not sure what the problem is. I would definitely instrument the react-native-firebase java or objective-c code (take your pick) to log out the parameters we send to the native APIs when you send a null in and I bet we are doing the right thing here. At which point it becomes an upstream bug and I'd advise trying the same test but without using react-native-firebase - you have to use the firebase SDKs directly and give the google firebase team a clean reproduction for them to triage an issue. They provide quickstarts that make that easy though: https://github.com/firebase/quickstart-android/tree/master/analytics / https://github.com/firebase/quickstart-ios/tree/master/analytics |
Hi @anuragraina - just curious if you got a chance to put some printouts in the javascript -> native code to see whether react-native-firebase is sending in the nulls to clear things correctly and move this forward |
I had the same issue with When trying to call `setUserProperty('usa_code', null), my XCode console would output:
After some debugging, I found out that
Here is my patch if someone needs it, I am going to open a PR soon:
EDIT: Even though Xcode says everything is fine, I still don't see the updates in the Firebase DebugView. Maybe it has to do with some cache (when I have to change a variable, I have to put the app in background for the change to be sent). |
Oh that's fantastic - looking forward to the PR, will check it and if everything looks good will be happy to merge! This one has been a sore point here. Probably a similar issue with Java (just not sending null in the right way? or perhaps it's working on Java but we just can't tell owing to DebugView oddity as you mention) |
Java seemed to work for me (I didn't get any error log). I will get my hands on a real Android device later this week to try and see if it appears as expected in the reports :) As for the PR I'll try to open it by the end of the week if it really works :) |
I'm going to reopen this and tag it up for review just in case since the patch exists in a comment at least |
Hello 👋, to help manage issues we automatically close stale issues.
|
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Hey @mikehardy, we are facing the same issue. Calling |
Sorry I don't have solid info but just replying since it was a direct question: there's no current work in this area, so if it is not working with current (13.0.1 IIRC), it will continue not working until it receives attention - apologies |
Unfortunately, we are not in the latest version, I'll try to upgrade and give you feedback about it. Thanks for the quick response. |
It's confirmed, the latest version doesn't work too. Is there any chance to give attention to this ASAP? It may be impacting others too. |
Sorry @emilioheinz this is/was in my queue but obviously I haven't had time to look at it yet, apologies. I can reopen but if a PR doesn't come from someone in the community rolling up their sleeves and investigating a) is it here or native SDKs? and b) posting PR here or logging upstream, there may not be activity for a bit sadly |
I'll try to take a look at this in some weeks and update it here with my progress. If anyone falls into this issue and wants to work on it, just do it, it will be really helpful. |
…ly remove user properties Closes invertase#4931
Hi all 👋 I also encountered this issue in an app I am working on so I have created a PR: #6004 to fix this issue. Would love to hear your feedback on this! |
…ly remove user properties Closes #4931
I'm using 14.5.0 and this still happen on Android. Anyone still encounter the same issue? |
Happening to me too in debug mode for iOS. I have the following dependencies:
|
Issue
await analytics().setUserId('Some id');
works perfect.But the issue arises when I set
await analytics().setUserId(null);
orawait analytics().setUserProperty('some_property', null);
This does not work and the same old id and property is shown in events.
This comment mentions the issue exactly.
Project Files
Javascript
Click To Expand
package.json
:# N/A
firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:10.6.4
Firebase
module(s) you're using that has the issue:analytics
TypeScript
?Y
&3.8.3
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: