-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Issue
After upgrading to 23.3.1 from 21.13.0 the body in the request for the flags is sending analyticsUserProperties as an empty object on android, making me unable to keep using my existing conditions on the remote config console.
I had to patch this in past versions due to the web implementation having the same issue but it was clear to me why web had this issue. That bridge of context between the two packages (Analytics and Remote config) on web just wasn't there so I ended up overriding that myself somewhat easily.
After the update I ran into the same issue for web (after clearing my pacthes) but now I also see this behaviour on android. The property is there in the body but is just empty. And can't find a straight forward path to fix
import { setUserId, setUserProperties, setUserProperty } from '@react-native-firebase/analytics'
On the other hand setCustomSignals seems to be working and I know I can do conditional targetting with those but I would have to go a redo every single condition we have using analytic properties
Project File
Javascript
const analytics = getAnalytics(firebaseApp())
const remoteConfig = getRemoteConfig(firebaseApp())
await setUserId(analytics, userId)
await setUserProperties(analytics,{foo: 1})
await fetchAndActivate(remoteConfig)
await setCustomSignals(remoteConfig, {foo: 1})
Expected request body
{
customSignals: {foo: 1},
analyticsUserProperties: {foo: 1},
...
}
Actual request body
{
customSignals: {foo: 1},
analyticsUserProperties: {},
...
}
Sample curl from the android app. I'm setting the exact same properties for custom signals and analytics
curl 'https://firebaseremoteconfig.googleapis.com/v1/projects/xxx/namespaces/firebase:fetch' \
-X 'POST' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'If-None-Match: etag-xxx-firebase-fetch--xxx' \
-H 'X-Android-Cert: XXX' \
-H 'X-Android-Package: com.xxx.apps.android' \
-H 'X-Firebase-RC-Fetch-Type: BASE/1' \
-H 'X-Goog-Api-Key: xxxx' \
-H 'X-Goog-Firebase-Installations-Auth: xxxxx' \
-H 'X-Google-GFE-Can-Retry: yes' \
--data-raw '{"appVersion":"1.0.0","customSignals":{"createdAt":"1739469104205","user_type":"free","phoneNumber":"","stage":"dev","platform":"android","email":"luis@xxx","user_privileges":"user,teacher,admin"},"timeZone":"GMT","appInstanceIdToken":"xxx","languageCode":"en-US","appBuild":"1","appInstanceId":"xxx","countryCode":"US","analyticsUserProperties":{},"appId":"xxx","platformVersion":"36","sdkVersion":"23.0.0","packageName":"com.xxx"}' \
--compressed
Click To Expand
package.json:
"@react-native-firebase/analytics": "23.3.1",
"@react-native-firebase/app": "23.3.1",
"@react-native-firebase/remote-config": "23.3.1",firebase.json for react-native-firebase v6:
# N/AiOS
Click To Expand
ios/Podfile:
- I'm not using Pods
- I'm using Pods and my Podfile looks like:
# N/AAppDelegate.m:
// N/AAndroid
Click To Expand
Have you converted to AndroidX?
- my application is an AndroidX application?
- I am using
android/gradle.settingsjetifier=truefor Android compatibility? - I am using the NPM package
jetifierfor react-native compatibility?
android/build.gradle:
// N/Aandroid/app/build.gradle:
// N/Aandroid/settings.gradle:
// N/AMainApplication.java:
// N/AAndroidManifest.xml:
<!-- N/A -->Environment
Click To Expand
react-native info output:
OUTPUT GOES HERE
- Platform that you're experiencing the issue on:
- iOS
- Android
- iOS but have not tested behavior on Android
- Android but have not tested behavior on iOS
- Both
- web (React Native web)
react-native-firebaseversion you're using that has this issue:e.g. 5.4.3
Firebasemodule(s) you're using that has the issue:e.g. Instance ID
- Are you using
TypeScript?Y/N&VERSION
- 👉 Check out
React Native FirebaseandInvertaseon Twitter for updates on the library.