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

[🐛] 🔥 Remote Config/Analytics: analyticsUserProperties not being sent on request body on Android when fetching for feature flags

Open pinki-palacios opened this issue 4 months ago • 1 comments

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/A

iOS

Click To Expand

ios/Podfile:

  • [ ] I'm not using Pods
  • [x] I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A

Android

Click To Expand

Have you converted to AndroidX?

  • [ ] my application is an AndroidX application?
  • [ ] I am using android/gradle.settings jetifier=true for Android compatibility?
  • [ ] I am using the NPM package 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:

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • [ ] iOS
    • [x] Android
    • [ ] iOS but have not tested behavior on Android
    • [ ] Android but have not tested behavior on iOS
    • [ ] Both
    • [x] web (React Native web)
  • react-native-firebase version you're using that has this issue:
    • e.g. 5.4.3
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION

pinki-palacios avatar Nov 03 '25 23:11 pinki-palacios

Could be caused from a breaking change android side it sounds like, my guess is a native issue, I am open to checking out a minimal repro for this.

MichaelVerdon avatar Nov 20 '25 14:11 MichaelVerdon