firebase-ios-sdk: remote config realtime listener frequently cannot fetch current version of the template

Description

In wrapping the realtime remote config feature for react-native-firebase I have noticed that the iOS SDK frequently generates this error:

 AssertionError: error {"code":"config_update_not_fetched","message":"Unable to fetch the latest version of the template..","nativeErrorMessage":"Unable to fetch the latest version of the template.."}

This does not happen in the same tests using the near-identical firebase-android-sdk APIs

Reproducing the issue

1- create a cloud function that uses the firebase-admin-sdk to alter a remote config template (like perhaps this one https://github.com/invertase/react-native-firebase/blob/feat%2Fremote-config-onconfigupdated/.github/workflows/scripts/functions/src/testFunctionRemoteConfigUpdate.ts) and wraps that behind a POST API

2- create a test that adds an SDK listener for realtime remoteconfig changes

3- post to your cloud function to update the template

4- repeat 3 until it fails here:

https://github.com/firebase/firebase-ios-sdk/blob/0e4aa6d4bd30898d1b502e7a171a24980d9e9133/FirebaseRemoteConfig/Sources/RCNConfigRealtime.m#L487-L492

Does the iOS SDK have different tunings with regard to retry intervals / retry count vs firebase-android-sdk? It’s curious that I’m coming close to 100+ trials now and android has never had this while on iOS I see it maybe 10% of the time.

As a follow-on, I’m not sure how I can work around this at the react-native-firebase level, or what to prescribe to our users if this happens. Should they attempt to use directly / manually fetch the new config template? Will that potentially run into caching or throttling issues vs the realtime updates?

Firebase SDK Version

10.11.0

Xcode Version

14.3.1

Installation Method

CocoaPods

Firebase Product(s)

Remote Config

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project’s Package.resolved

Expand Package.resolved snippet

Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project’s Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

The change has been merged in, closing this issue

Okay - I still seem to have a tiny bit of flakiness in my tests, but that is on me to investigate. The simulator logging with equivalent of FIRLogDebug enabled and this patch appears to have excellent results

(stated differently: SDK behavior as seen in logs looks great now every time, whatever flakiness is happening is at the react-native-firebase or testing layer I think)

I’m 5 for 5 with everything looking great in the logs.

Thanks for letting us know the outcome of your tests. Now that we know increasing the fetch count doesn’t work consistently, we can try removing this check. I’ve updated the PR to include this change. Please try this on e2e test and let us know how it does.

https://github.com/firebase/firebase-ios-sdk/pull/11465

Hey @mikehardy looking into this issue now. For this situation, based on your logs, I think the issue that is happening is that the real-time fetch runs into a isFetchInProgress check and essentially wastes a real-time initiated fetch if it coincides with a previous fetch. Android does not have a isFetchInProgress check so that would explain why iOS only sees this issue. One thing we could do is increase the number of fetchAttempts and see if that fixes your issue temporarily while we work on a longer term fix.