nuxt-community / firebase-module

🔥 Easily integrate Firebase into your Nuxt project. 🔥
https://firebase.nuxtjs.org
MIT License
642 stars 98 forks source link

Remote config default values not fetched #281

Closed malkomich closed 4 years ago

malkomich commented 4 years ago

The default values for Firebase Remote Config are never fetched.

Version

@nuxtjs/firebase: 6.1.1 firebase: 7.17.2 nuxt: 2.14.1

Steps to reproduce

Add some new value in the following config section of the file nuxt.config.js: firebase.services.remoteConfig.defaultConfig Option 1: Do not add that new value in your Firebase console. Option 2: Disable Firebase Remote Config API in GCloud.

What is Expected?

The value for that config can not be fetched, so the configured default value should be taken.

What is actually happening?

The value for that config can not be fetched, so no value is taken and default value is ignored.

lupas commented 4 years ago

@malkomich

Thanks for the issue and sorry for the late reply! I'll have a look at it asap. I'm working on v7 now and will probably fix the issue in that release.

jack-mullen commented 4 years ago

If anyone else has this issue in the meantime, I managed to resolve this in our config by adding defaultConfig to the settings object inside the remoteConfig config object, instead of having it directly inside the remoteConfig object.

So before, I had this:

 remoteConfig: {
     settings: {
         fetchTimeoutMillis: 60000,
     },
     defaultConfig: {
         my_config_item: "hello",
     },
 },

And now I have this:

 remoteConfig: {
     settings: {
         fetchTimeoutMillis: 60000,
         defaultConfig: {
             my_config_item: "hello",
         },
     },
 },

Not sure if this was an intended change or not, as the docs still suggest to do it the first (now broken) way.

lupas commented 4 years ago

Hey guys This was a mistake in the code, the defaultConfig should be a child of the remoteConfig object. The settings object is meant to reflect exactly what needs to be set with remoteConfig.settings({}).

This has been fixed with https://github.com/nuxt-community/firebase-module/commit/7e1020c3c024c2b938f8a339a38d700036f46605 and will be published with the upcoming v7.0.0.

So by then you will need to change back your options to the way it is documented. I'll also mention it in the release notes.

Thanks guys for pointing that out!