angularfire: app.auth is not a function

Version info

Angular: 6.0.0

Firebase: 5.0.4

AngularFire: 5.0.0-rc.10

Other (e.g. Ionic/Cordova, Node, browser, operating system): WSL, Node 8.11.2, Cordova, etc.

I receive the message:

app.auth is not a function

This occurs in the following code on the line return app.auth():

var AngularFireAuth = (function () {
  function AngularFireAuth(options, nameOrConfig, platformId, zone) {
    var _this = this;
    this.zone = zone;
    var scheduler = new angularfire2__WEBPACK_IMPORTED_MODULE_3__["FirebaseZoneScheduler"](zone, platformId);
    this.auth = zone.runOutsideAngular(function () {
        var app = Object(angularfire2__WEBPACK_IMPORTED_MODULE_3__["_firebaseAppFactory"])(options, nameOrConfig);
        return app.auth();
    });

app seems to be well-formed:

image

but it has no auth property. I am instantiating (or rather, Angular is instantiating) AngularFireAuth because it is injected into a service, which itself is instantiated quite early in the application life cycle. Was there some change in how soon the app is completely ready, including its auth property? Or is this possibly some kind of version conflict?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Had the same issue after upgrading to angularfire2 5.0.0-rc-11 and firebase 5.0.4.
Reinstalled node_modules, cleaned node cache, and app.auth is not a function keep showing.

SOLUTION After pretty much time debugging, did the following and it worked:

  • created a new FRESH angular project
  • installed angularfire and firebase $ npm install firebase angularfire2 --save
  • replaced complete /src folder in new project with previous project /src folder.
  • added required dependencies to package.json from previous project and run npm install
  • run $ ng serve and worked.

CLI and package versions:

  Angular CLI: 6.1.4
  Node: 8.11.2
  OS: win32 x64
  Angular: 6.1.3

  "angularfire2": "^5.0.0-rc.11",
  "firebase": "^5.4.0"