Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
Firebase - remote config on web sometimes gets values and sometimes not

I'm new to programming in Javascript (I haven't even been programming for a month, but I have experience in other non-asynchronous languages).

I'm having trouble connecting the Firebase config to my website, sometimes it shows values, other times it doesn't.

if (app_data) {
    console.log("Step 0");
    remoteConfig = getRemoteConfig(app_data);
    remoteConfig.settings.minimumFetchIntervalMillis = 10000;
  } else {
    console.log("No se ha podido conectar a la base de datos.");
  }

  if (fetchAndActivate(remoteConfig)) {
    console.log("Paso por 2");
    obj_config = getAll(remoteConfig);
    console.log("Paso por 3");
    Object.entries(obj_config).forEach((x) => {
      const [key, entry] = x;
      if (key === "contract_address") {
        contract_token = entry["_value"];
        console.log("Key Address: ", entry["_value"]);
      }
      console.log("Key: ", key);
      console.log("Source: ", entry.getSource());
      console.log("Value: ", JSON.stringify(entry["_value"]));
    });
    
  }

If someone could help me, I would be very grateful.

Greetings

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

fetchAndActivate is async, so it won't have finished fetching yet:

instead of

if (fetchAndActivate(remoteConfig)) {
  //code
}

try

fetchAndActivate(remoteConfig).then(() => {
  // code
});
about 4 years ago · Juan Pablo Isaza Report

0

If you are using Javascript, you could try to use await in your code because the fetching step is asynchronous. Something like

const rcResult = await asyncFetchFromRC()
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!