angular / angular/angularfire

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

Ouverte
#2,999 4 commentaires 7 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
7.8k
Forks
2.2k
Merge moyen
22 h 28 min
PR mergées (30 j)
6

Description

### 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.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Clonez le dépôt de reproduction lié et suivez son README, en commençant par la configuration Firebase dans app.module et le service qui utilise getDatabase. Comparez cette configuration avec le modèle d’injection Firestore fonctionnel et remontez jusqu’à l’erreur getSchedulers. La tâche est terminée lorsque l’application générée démarre sans l’erreur AngularFireModule et que Firebase Realtime Database peut être interrogée via le token d’injection.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
database
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.