diff --git a/docs/remote-config/usage/index.md b/docs/remote-config/usage/index.md index 5ddc9b84d3..bd0ff5f79d 100644 --- a/docs/remote-config/usage/index.md +++ b/docs/remote-config/usage/index.md @@ -186,7 +186,10 @@ in applications that attach one or more listeners for them. 1. **Keys considered updated until activated:** Config template keys are considered updated _if they have been changed since you last **activated** the remote config template_. If you never activate the new template, previously changed keys will continue to show up in the set of updated keys sent to your registered listener callback 1. **Real-time updates has a cost:** If you attach a listener, the native SDK opens a persistent web socket to the firebase servers. If all listeners are unsubscribed, this web socket is closed. Consider the battery usage and network data usage implications for your users 1. **_Unactivated changes result in immediate callback_** If there has been a template change since you last activated, and you attach a listener, that listener will be called _immediately_ to update you on the pending changes -1. **_Handle errors / retry in callback_** During testing here in react-native-firebase, we frequently received the "config_update_not_fetched" error when performing updates and fetching them rapidly. This may not occur in normal usage but be sure to include error handling code in your callback. If this error is raised, you should be able to fetch and activate the new config template with retries after a timeout + +### Known Issues + +1. **_Handle errors / retry in callback_** During testing here in react-native-firebase, we frequently received the "config_update_not_fetched" error when performing updates and fetching them rapidly. This may not occur in normal usage but be sure to include error handling code in your callback. If this error is raised, you should be able to fetch and activate the new config template with retries after a timeout. Tracked as https://github.com/firebase/firebase-ios-sdk/issues/11462 and a fix is anticipated in firebase-ios-sdk 10.12.0 Here is an example of how to use the feature, with comments emphasizing the key points to know: diff --git a/packages/remote-config/e2e/config.e2e.js b/packages/remote-config/e2e/config.e2e.js index d07e5a9cd2..5160e9cb79 100644 --- a/packages/remote-config/e2e/config.e2e.js +++ b/packages/remote-config/e2e/config.e2e.js @@ -818,6 +818,20 @@ describe('remoteConfig() modular', function () { await Utils.spyToBeCalledTimesAsync(callback, 1, 60000); should(callback.callCount).equal(1); let callbackError = callback.getCall(0).args[1]; + + if ( + device.getPlatform() === 'ios' && + callbackError !== undefined && + callbackError.code === 'config_update_not_fetched' + ) { + // FIXME indicates known issue firebase-ios-sdk#11462 - should be fixed in release 10.12.0 + // not much we can do, skip the test, but remove this with adoption of 10.12.0 + // eslint-disable-next-line no-console + console.error('firebas-ios-sdk#11462 encountered, skipping test'); + // eslint-disable-next-line no-console + console.error('error contents: ' + JSON.stringify(callback.getCall(0).args[1])); + this.skip(); + } should(callbackError).equal(undefined, 'error ' + JSON.stringify(callbackError)); let callbackEvent = callback.getCall(0).args[0]; // This may sometimes flake if the device does not have the correct template fetched yet, @@ -863,6 +877,19 @@ describe('remoteConfig() modular', function () { await Utils.spyToBeCalledTimesAsync(callback3, 1, 60000); [callback1, callback2, callback3].forEach(callback => { should(callback.callCount).equal(1); + if ( + device.getPlatform() === 'ios' && + callback.getCall(0).args[1] !== undefined && + callback.getCall(0).args[1].code === 'config_update_not_fetched' + ) { + // FIXME indicates known issue firebase-ios-sdk#11462 - should be fixed in release 10.12.0 + // not much we can do, skip the test, but remove this with adoption of 10.12.0 + // eslint-disable-next-line no-console + console.error('firebas-ios-sdk#11462 encountered, skipping test'); + // eslint-disable-next-line no-console + console.error('error contents: ' + JSON.stringify(callback.getCall(0).args[1])); + this.skip(); + } should(callback.getCall(0).args[1]).equal( undefined, 'error ' + JSON.stringify(callback.getCall(0).args[1]),