angular / angular/angularfire

Unable to provide getDatabase(): Error: AngularFireModule has not been provided at getSchedulers

Aperta
#2,999 4 commenti 7 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
7.8k
Fork
2.2k
Merge medio
22h 28m
PR unite (30g)
6

Descrizione

### Version info

**Angular:**
12.x.x

**Firebase:**
9.x.x

**AngularFire:**
7.x.x

**Other (e.g. Ionic/Cordova, Node, browser, operating system):**
Newly generated angular project with no SSR

### How to reproduce these conditions

**Failing test unit, Stackblitz demonstrating the problem**

Clone this repo and follow the README instructions

https://github.com/thatgirlcancode/angular-fire-issue

**Steps to set up and reproduce**

1. npm install
2. Add your Firebase environment config settings in app.module
3. Run ng serve or npm run start and Navigate to http://localhost:4200/
4. You will see in browser developer tools the error: Error: AngularFireModule has not been provided at getSchedulers

**Sample data and security rules**

### Debug output

** Errors in the JavaScript console **
`Error: AngularFireModule has not been provided at getSchedulers`

** Output from `firebase.database().enableLogging(true);` **
`undefined`

** Screenshots **

### Expected behavior

Firebase Realtime Database is configured and I'm able to use injection token in Firebase Service to query the database.

I have no issues configuring Firestore in this same way. I'm able to do this same provider/injection token pattern using `initializeApp` and `getFirestore` and it works beautifully. What is the difference with `getDatabase`?

### Actual behavior

`Error: AngularFireModule has not been provided at getSchedulers` is thrown and the web page is blank.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Clonate il repository di riproduzione collegato e seguite il relativo README, iniziando dalla configurazione Firebase in app.module e dal servizio che usa getDatabase. Confrontate questa configurazione con il pattern di injection di Firestore funzionante e tracciate l’errore getSchedulers. Il lavoro è completato quando l’app generata si avvia senza l’errore AngularFireModule e Firebase Realtime Database può essere interrogato tramite il token di injection.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
database
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.