-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
HMR t v6.1.0 RC3: Firestore Emulators Error: Precondition failed #2655
Comments
I'm getting this too. Stack trace indicates this has to do with redeclaring AngularFirestore : You can reproduce by commenting any piece of code (except root styles) and let Webpack pick up the change. @Meistercoach83 Maybe you could rename the issue with a more precise description |
hmr would make sense, as firebase has side effects and angularfire is for the most part side-effect free. e.g, AngularFirestore doesn't keep a global cache of it's instantiated instances. Instead when it's initialized it merrily tries to create and initialize a new firestore instance. There's two work arounds here IMO, A) keep a global cache for instantiated firestore instances B) inspect the settings/options on an instantiated instance & check that they match the passed in settings, else try to apply and error out if it fails. The benefit of B would be better guard rails incase someone tries to mess with DI to change firestore settings without creating a second app & you'd get a helpful error if you changed the DI with hmr on. I'll investigate that option today. |
#2661) * Adding global instance caches to the modules, so they don't freak out when HMR is enabled (#2655). This takes on `globalThis` as a needed polyfill for many environments. * If injected settings for modules are changed after they are initialized you will receive a warning and the prior instance will be returned (ignoring the changes), this is especially important for HMR. If HMR is detected there will be an additional warning suggesting they do a full reload to see the changes. * Added a polyfill table and notes about why we version like we do * Adding more convoluted stuff to my sample app to flex AngularFire * Internal cleanup on AngularFireAnalytics * AngularFireAnalytics will now wait for UserTrackingService to detect the user before sending the screen_view event, if UserTrackingService has been provided * Adding a warning if the Auth Emulator is detected in conjunction with AngularFirestore and AngularFireDatabase as they will invalidate the emulated auth token before the dynamic import of `firebase/auth` is completed (#2656) * Warn if we absorbed an error keeping Firestore persistence from enabling * Logging sign_up and login events in UserTrackingService * Adding credential observer to AngularFireAuth
This should be resolved in |
I added a |
Hey there! I have a problem with firebase / angularfire2 (latest rc) and the cloud emulators. If I add this
{ provide: USE_FIRESTORE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 8080] : undefined },
to my app.module, the routing (with guards) is not working any longer with the error message "NavigationError(id: 2, url: '/setup', error: FirebaseError: [code=failed-precondition]: Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.) platform-browser.js:66 " Can anyone help me with that?
Version info
Angular: 11.0.0
Firebase: 8.16.1
AngularFire: latest RC 6.1.0-rc.3
Other (e.g. Ionic/Cordova, Node, browser, operating system):
Angular CLI: 11.0.1
Node: 12.18.1
OS: win32 x64
The text was updated successfully, but these errors were encountered: