Unable to provide getDatabase(): Error: AngularFireModule has not been provided at getSchedulers
- Dominant language
- TypeScript
- Stars
- 7.8k
- Forks
- 2.2k
- Avg merge
- 22h 28m
- Merged PRs (30d)
- 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.
Contributor guide
Research direction
Clone the linked reproduction repository and follow its README, starting with the Firebase configuration in app.module and the service using getDatabase. Compare that setup with the working Firestore injection pattern and trace the getSchedulers error. Done means the generated app starts without the AngularFireModule error and the Firebase Realtime Database can be queried through the injection token.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100