firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Remote Config not pulling latest configuration without hard cache reload on web

Open enterprisecoderr opened this issue 1 year ago • 4 comments

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

  1. Setup remote config in a js class that calls fetch and activate and sets the remote config minimumFetchTimeIntervalMillis to 0
  2. Use that remote config service class in a stencil component
  3. Pull a remote configuration parameter and log it to the console
  4. Update the remote configuration
  5. Refresh the page and see if the logged config changed. The current behavior is that it doesn't

enterprisecoderr avatar May 08 '24 16:05 enterprisecoderr

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar May 08 '24 16:05 google-oss-bot

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:

  1. Edit the src/app/app.tsx to be:
const remoteConfig = getRemoteConfig(app);

remoteConfig.settings.minimumFetchIntervalMillis = 0;
fetchAndActivate(remoteConfig)
.then(()=>{
  const value = getValue(remoteConfig, "someKey")
  .asString()
  console.log(`Value: ${value}`);

})
  1. Run npm run start
  2. Visit the http://localhost:4200/
  3. Update the remote config value in the console
  4. 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.

jbalidiong avatar May 10 '24 13:05 jbalidiong

I am not using the bundled fetchAndActivate command. I'm calling activate and then later fetchConfig. Can you try with that setup?

enterprisecoderr avatar May 10 '24 15:05 enterprisecoderr

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.

jbalidiong avatar May 10 '24 18:05 jbalidiong

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!

google-oss-bot avatar May 17 '24 01:05 google-oss-bot

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.

google-oss-bot avatar May 23 '24 01:05 google-oss-bot