Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase remoteConfig return no value #2186

Closed
KevynBct opened this issue Nov 19, 2020 · 15 comments
Closed

Firebase remoteConfig return no value #2186

KevynBct opened this issue Nov 19, 2020 · 15 comments
Assignees

Comments

@KevynBct
Copy link

KevynBct commented Nov 19, 2020

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 4.1.1
  • Firebase Component: firebase-config/firebase-config-ktx
  • Component version: 20.0.1

Hello everyone,

Since I've updated the component firebase-config from 20.0.0 to 20.0.1, I can't get values from Firebase.remoteConfig.

Nothing has changed in my code since previous version :

First I fetch and active in my MainActivity

val configSettings = remoteConfigSettings {
    minimumFetchIntervalInSeconds = 3600
}

Firebase.remoteConfig.setConfigSettingsAsync(configSettings)

Firebase.remoteConfig.fetchAndActivate().addOnCompleteListener(this) { task ->

    if (task.isComplete) {
        // Some code here
    }

}

And then in a fragment I get values :

with (Firebase.remoteConfig) {

    val a = getValue("key1").asString()
    val b = getValue("key2").asString()

}
@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@T1mmyK0
Copy link

T1mmyK0 commented Nov 23, 2020

I have the same issue.
When updating the app to the new RemoteConfig version, no values are received anymore and the default values apply.
Reinstalling fixes the issue, but I cannot ask all my users to reinstall the app or clear data.

@AgiMaulana
Copy link

I've encountered the same issue. The value has been synced in previous remote config SDK version when it updated with the version of 20.0.1 the data was lost. Although can be resolved simply by staling the remote config this is not the convenient way I think.

@AgiMaulana
Copy link

This is reproducible, try to build with the version 19.2.0 everything is okay, then rebuild with the version 20.0.1 remote config return no value for the given key

@T1mmyK0
Copy link

T1mmyK0 commented Nov 25, 2020

@AgiMaulana Same here. And when downgrading to 20.0.0 it works fine again. I have downgraded RemoteConfig in my production apk again.

@danasilver
Copy link
Contributor

Looking into this. I'm unable to reproduce it in a new Kotlin app with firebase-config-ktx:20.0.1 and firebase-analytics-ktx:18.0.0 as dependencies. @vic-flair do you mind taking a look, too?

@bocops
Copy link

bocops commented Dec 1, 2020

@danasilver I'm seeing the same as others have reported, with a firebase-config:20.0.x dependency and a firebase-analytics:18.0.0 dependency (transitively via firebase-core):

  1. Fresh install (via Android Studio, "Debug app") of app with a 20.0.0 dependency.
  2. Run app, correct remote config values are shown
  3. Stop app
  4. Update dependency to 20.0.1 and install.
  5. Run app, correct remote config values are not shown

If, between steps 3 and 4, I "clear data" for this app on the device, everything works correctly.

If, instead of clearing data, I set the device to airplane mode before steps 4/5, correct values are still not shown. Because of this, I believe the problematic part is not actually the fetching but the activating of a remote config that is already cached on the device.

@bocops
Copy link

bocops commented Dec 1, 2020

Could the issue be ConfigStorageClient.read() (permalink below)?

It seems that, if a config was written to disk without personalization (version <20.0.1), then trying to read it with personalization (version =20.0.1) should lead to JSONObject.getJSONObject(key) being called with a key that doesn't exist via ConfigContainer.copyOf() and thus throwing a JSONException, which in turn makes the method return null.

@danasilver
Copy link
Contributor

@bocops Thanks for the help investigating. I'm able to reproduce the issue now with those steps. It does seem like the issue is reading the cached config. Working on a fix for this.

@maulikhirani
Copy link

This issue is really scary.
Can we expect a fixed version ASAP?

Now that Firebase is recommending BoM (Bills of Materials) for adding dependencies, I don't want to specify an older version explicitly just for Remote Config.

@AgiMaulana
Copy link

For everyone who has shipped the remote config 20.0.1 within your production app and already implemented propagating realtime update, you can to try propagate realtime update to stale the local config so the app can rewrite local config with a new one using the new writing scheme.

I've fix the issue on production app using that workaround

@jd565
Copy link

jd565 commented Dec 3, 2020

We have had the same issue and fixed by noticing when the app has been updated and calling FirebaseRemoteConfig.getInstance().reset(), which has fixed the issue for us.

@danasilver
Copy link
Contributor

Remote Config SDK version 20.0.2 is live now with a fix. A new version of the Firebase BOM (26.1.1) has been released, too, including this version.

Thanks all for your help reporting and investigating the issue!

@XinyueZ
Copy link

XinyueZ commented Dec 9, 2020

Was this bug impacting the Flutter version?

@danasilver
Copy link
Contributor

@XinyueZ I don't think this affected Flutter since it looks like the Flutter SDK is using Firebase Android BOM 25.12.0 and this issue was in version 26.1.0 of the BOM. It's fixed in version 26.1.1.

@firebase firebase locked and limited conversation to collaborators Jan 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants