Remote Config not pulling latest configuration without hard cache reload on web
Operating System
macOS 14.4.1 (23E224)
Browser Version
Version 124.0.6367.62 (Official Build) (arm64)
Firebase SDK Version
10.11.1
Firebase SDK Product:
Remote-Config
Describe your project's tooling
Nx based stencil project building MFEs. There is a class utilized as a generic service that gets remote configurations from firebase, that is pulled into the MFEs and other clients like angular apps
Describe the problem
The problem is that when I update firebase remote config and do a simple refresh multiple times, the latest config is not pulled. I am using the fetch and activate functions to get the remote config. I have to do a hard cache reload to see the latest config. Is there a cache setting I can toggle in addition to the minimumfetchtimeintervalmillis?
Steps and code to reproduce issue
- Setup remote config in a js class that calls fetch and activate and sets the remote config minimumFetchTimeIntervalMillis to 0
- Use that remote config service class in a stencil component
- Pull a remote configuration parameter and log it to the console
- Update the remote configuration
- Refresh the page and see if the logged config changed. The current behavior is that it doesn't
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hi @enterprisecoderr, thanks for reaching out to us. I'm wasn't able to reproduce the behavior that you've mentioned. I tried fetchAndActivate() using the ff:
- Edit the
src/app/app.tsxto be:
const remoteConfig = getRemoteConfig(app);
remoteConfig.settings.minimumFetchIntervalMillis = 0;
fetchAndActivate(remoteConfig)
.then(()=>{
const value = getValue(remoteConfig, "someKey")
.asString()
console.log(`Value: ${value}`);
})
- Run
npm run start - Visit the
http://localhost:4200/ - Update the remote config value in the console
- Refresh the page and get the updated value.
To get a better understanding of what’s causing the failed fetch, could you provide a minimal, but complete sample of a project that I can run locally.
I am not using the bundled fetchAndActivate command. I'm calling activate and then later fetchConfig. Can you try with that setup?
Hi @enterprisecoderr, I tried using the fetchConfig and activate but I still wasn't able to replicate the behavior. Here is the sample snippet of my code:
fetchConfig(remoteConfig)
.then(()=>{
activate(remoteConfig)
.then(()=>{
const value = getValue(remoteConfig, "someKey")
.asString()
console.log(`Value: ${value}`);
})
.catch((error)=>{
console.log(error)
});
})
.catch((error)=>{
console.log(error)
});
I used .then() and called activate() to avoid any race condition as both activate and fetchConfig returns a promise. Could you try following the implementation and see if the behavior persists.
Hey @enterprisecoderr. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@enterprisecoderr if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.