Search code examples
javascriptfirebasegoogle-cloud-platformfirebase-remote-config

Firebase Remote Config (Web) always uses default values for Samsung Internet


I've tried to use the Javascript SDK for Firebase Remote Config with my website. For some reason the code works fine when customers browse the website with Chrome, Edge, Vivaldi, and some other browsers. But when the site is viewed using Samsung Internet, or Polypane, the remote config always uses the default values supplied in code, without reaching for the existing ones from the firebase online project. Is someone able to direct me how I might fix this? Code is below:

<script>
    
      const remoteConfig = firebase.remoteConfig();
          remoteConfig.settings = {
            
              fetchTimeMillis: 60000,
              minimumFetchIntervalMillis: 300000

          }
          
          remoteConfig.defaultConfig = ({
  'maintenance_mode_enabled': "false",
              'maintenance_mode_message': "Apologies, our website is unavailable at present. Please direct your enquiries to us by email, or check back here later."
});
        
          
          
          
          
         remoteConfig.fetchAndActivate()
  .then(() => {
              console.log("Thinking");
              
        const val = remoteConfig.getValue("maintenance_mode_enabled");
        const val2 = remoteConfig.getValue("maintenance_mode_message");
                      console.log(val);
                      console.log(val2);
        const maintenance_element = document.getElementById('maintenancemodeoverlay');
              const maintenance_message = document.getElementById('maintenancemodemessage');
              if(val._value=="true" && sessionStorage.bypass != "true"){
                          console.log("Enabling");
                  
                  maintenance_element.style.visibility = "visible";
                  maintenance_message.innerHTML = val2._value;
                  console.log(val2._value);
              }
        
              
              
  })
  .catch((err) => {
    console.error('Firebase Remote Config failed to initialize', err);
  });
  
         
      </script>

Solution

  • It turns out this was actually a bug in Firebase's system. After contacting support, they forwarded the bug onto their software engineers who fixed the issue within a day.