You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
I'm facing an issue while fetching Firebase Remote Config in my React Native project while testing on the IOS Platform. The fetchAndActivate request fails with the following error:
[remoteConfig/unknown] cancelled.
Code Snippet
import remoteConfig from '@react-native-firebase/remote-config';
import { FIREBASE_REMOTE_CONFIG_KEYS } from '../../../constants/variables';
import {
crashlyticsTrackErrorEvent,
crashlyticsTrackInfoEvent,
} from '../crashlytics/firebase.crashlytics.index';
import remoteConfigDefault from './remoteConfigDefautl.json';
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Description:
I'm facing an issue while fetching Firebase Remote Config in my React Native project while testing on the IOS Platform. The fetchAndActivate request fails with the following error:
[remoteConfig/unknown] cancelled.
Code Snippet
import remoteConfig from '@react-native-firebase/remote-config';
import { FIREBASE_REMOTE_CONFIG_KEYS } from '../../../constants/variables';
import {
crashlyticsTrackErrorEvent,
crashlyticsTrackInfoEvent,
} from '../crashlytics/firebase.crashlytics.index';
import remoteConfigDefault from './remoteConfigDefautl.json';
export const initializeRemoteConfig = async () => {
try {
console.log('initializeRemoteConfig : first attempt');
// Initialize Firebase Remote Config
await remoteConfig().setConfigSettings({
minimumFetchIntervalMillis: 60000, // Minimum fetch interval (e.g., 15 min)
});
await remoteConfig().setDefaults(remoteConfigDefault);
} catch (error) {
console.error('initializeRemoteConfig : error', error);
crashlyticsTrackErrorEvent(error, 'firebase.remoteConfig.Index.initializeRemoteConfig');
crashlyticsTrackInfoEvent(
[initializeRemoteConfig]: Failed Initialize Firebase Remote Config - ${error}
);
}
};
export const getAllRemoteConfigValues = async () => {
try {
await remoteConfig().fetchAndActivate();
const forceUpdate = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.ForceUpdate)
.asBoolean();
const appVersion = remoteConfig().getValue(FIREBASE_REMOTE_CONFIG_KEYS.appVersion).asString();
const enableUpdate = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.EnableUpdate)
.asBoolean();
const IsMaintenanceActive = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.IsMaintenanceActive)
.asBoolean();
const intervalTimeShowUpdate =
remoteConfig().getValue(FIREBASE_REMOTE_CONFIG_KEYS.intervalTimeShowUpdate).asNumber() ||
600000;
const testimonial = remoteConfig().getValue(FIREBASE_REMOTE_CONFIG_KEYS.testimonial).asString();
const influencePicture = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.influencePicture)
.asString();
const enableContactPermissionBanner = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.enableContactPermissionBanner)
.asBoolean();
const enablePromotionBanner = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.enablePromotionBanner)
.asBoolean();
const enablePushNotificationBanner = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.enablePushNotificationBanner)
.asBoolean();
const enableSendRechargeBanner = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.enableSendRechargeBanner)
.asBoolean();
const JLRechargeInstagramLink = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.JLRechargeInstagramLink)
.asString();
const JlRechargeFacebookLink = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.JlRechargeFacebookLink)
.asString();
const fbMessageUrl = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.FbMessageUrl)
.asString();
const supportEmail = remoteConfig()
.getValue(FIREBASE_REMOTE_CONFIG_KEYS.SupportEmail)
.asString();
const whatsAppUrl = remoteConfig().getValue(FIREBASE_REMOTE_CONFIG_KEYS.WhatsAppUrl).asString();
return {
enableUpdate,
fbMessageUrl,
supportEmail,
whatsAppUrl,
enableSendRechargeBanner,
enablePushNotificationBanner,
enablePromotionBanner,
enableContactPermissionBanner,
influencePicture,
forceUpdate,
IsMaintenanceActive,
appVersion,
intervalTimeShowUpdate,
testimonial,
JLRechargeInstagramLink,
JlRechargeFacebookLink,
};
} catch (error) {
console.error('getAllRemoteConfigValues : error', error);
crashlyticsTrackErrorEvent(error, 'firebase.remoteConfig.Index.getAllRemoteConfigValues');
crashlyticsTrackInfoEvent(
[fetchAndActivate]: Error fetching from Firebase Remote Config - ${error}
);
}
};
export const loadRemoteConfigurations = async () => {
try {
console.log('loadRemoteConfigurations : second attempt');
await remoteConfig().setDefaults(remoteConfigDefault);
await remoteConfig().fetchAndActivate();
const allConfigKeys = remoteConfig().getAll();
let remoteConfiguration = {};
Object.entries(allConfigKeys).forEach((configValue) => {
const [keyName, entry] = configValue;
switch (keyName) {
case FIREBASE_REMOTE_CONFIG_KEYS.EnableUpdate:
remoteConfiguration.enableUpdate = entry.asBoolean();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.ForceUpdate:
remoteConfiguration.forceUpdate = entry.asBoolean();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.IsMaintenanceActive:
remoteConfiguration.IsMaintenanceActive = entry.asBoolean();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.appVersion:
remoteConfiguration.appVersion = entry.asString();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.testimonial:
remoteConfiguration.testimonial = entry.asString();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.influencePicture:
remoteConfiguration.influencePicture = entry.asString();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.enableContactPermissionBanner:
remoteConfiguration.enableContactPermissionBanner = entry.asBoolean();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.enablePromotionBanner:
remoteConfiguration.enablePromotionBanner = entry.asBoolean();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.enablePushNotificationBanner:
remoteConfiguration.enablePushNotificationBanner = entry.asBoolean();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.enableSendRechargeBanner:
remoteConfiguration.enableSendRechargeBanner = entry.asBoolean();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.JlRechargeFacebookLink:
remoteConfiguration.JlRechargeFacebookLink = entry.asString();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.JLRechargeInstagramLink:
remoteConfiguration.JLRechargeInstagramLink = entry.asString();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.WhatsAppUrl:
remoteConfiguration.whatsAppUrl = entry.asString();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.FbMessageUrl:
remoteConfiguration.fbMessageUrl = entry.asString();
break;
case FIREBASE_REMOTE_CONFIG_KEYS.SupportEmail:
remoteConfiguration.supportEmail = entry.asString();
break;
}
});
return remoteConfiguration;
} catch (error) {
console.error('loadRemoteConfigurations : error', error);
crashlyticsTrackErrorEvent(error, 'firebase.remoteConfig.Index.loadRemoteConfigurations');
crashlyticsTrackInfoEvent([loadRemoteConfigurations]: Failed - ${error});
}
};
Firebase Package Version
"@react-native-firebase/analytics": "^21.6.1",
"@react-native-firebase/app": "^21.6.1",
"@react-native-firebase/app-check": "^21.6.1",
"@react-native-firebase/auth": "^21.6.1",
"@react-native-firebase/crashlytics": "^21.6.1",
"@react-native-firebase/dynamic-links": "^21.6.1",
"@react-native-firebase/firestore": "^21.6.1",
"@react-native-firebase/messaging": "^21.6.1",
"@react-native-firebase/perf": "^21.6.1",
"@react-native-firebase/remote-config": "^21.6.1",
Environment Info
System:
OS: macOS 14.4.1
CPU: (8) arm64 Apple M1
Memory: 74.58 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.20.5 - ~/.nvm/versions/node/v18.20.5/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v18.20.5/bin/npm
Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 133.0.6943.55
Safari: 17.4.1
npmGlobalPackages:
corepack: 0.29.4
firebase-tools: 13.30.0
npm: 10.8.2
react-devtools: 6.0.1
react-native-cli: 2.0.1
Beta Was this translation helpful? Give feedback.
All reactions