mikkopaderes / ember-firebase-service

Exposes a service that's a direct representation of Firebase
MIT License
4 stars 2 forks source link

Add assert to check that firebase config is present #50

Open dknutsen opened 3 years ago

dknutsen commented 3 years ago

Adds an assert that checks that a firebase config is present so the resulting error is less cryptic (see this issue)

If no firebase config exists or if it is not of type "object" this error will be thrown:

            Error: Assertion Failed: Please set the `firebase` property in your environment config.
                at assert (http://localhost:7357/assets/vendor.js:36254:15)
                at Object.create (http://localhost:7357/assets/vendor.js:100504:86)
                at FactoryManager.create (http://localhost:7357/assets/vendor.js:1266:25)
                at Proxy.create (http://localhost:7357/assets/vendor.js:980:20)
                at instantiateFactory (http://localhost:7357/assets/vendor.js:1081:71)
                at lookup (http://localhost:7357/assets/vendor.js:1009:12)
                at Container.lookup (http://localhost:7357/assets/vendor.js:874:14)
                at Class.lookup (http://localhost:7357/assets/vendor.js:27112:33)
                at Object.initialize (http://localhost:7357/assets/vendor.js:99200:34)
                at http://localhost:7357/assets/vendor.js:37284:21

If firebase config is present but empty or missing items firebase itself will take care of the rest, e.g.

            FirebaseError: "projectId" not provided in firebase.initializeApp.
                at new Br (http://localhost:7357/assets/vendor.js:69452:52485)
                at http://localhost:7357/assets/vendor.js:69452:273146
                at Sp.dp (http://localhost:7357/assets/vendor.js:69452:273263)
                at new Sp (http://localhost:7357/assets/vendor.js:69452:279707)
                at ym.instanceFactory (http://localhost:7357/assets/vendor.js:69452:336579)
                at C.getOrInitializeService (http://localhost:7357/assets/vendor.js:349:10320)
                at C.getImmediate (http://localhost:7357/assets/vendor.js:349:7312)
                at $._getService (http://localhost:7357/assets/vendor.js:349:16917)
                at $.n.type.a.<computed> [as firestore] (http://localhost:7357/assets/vendor.js:349:19680)
                at Object.initialize (http://localhost:7357/assets/vendor.js:99201:25)