yarpi87
yarpi87

Reputation: 113

Angularfire and Firebase upgrade error: Unknown provider: $firebaseAuthProvider <- $firebaseAuth

I've tried to upgrade my web app to new firebase 3.3.0 (from 2.4.0) and also did upgrade on angularfire to 2.0.2 (from 1.1.3). Before update - everything worked fine.

Update based on this tutorial: https://firebase.google.com/support/guides/firebase-web .

Now I get Error:

angular.js:68 Uncaught Error: [$injector:unpr] Unknown provider: $firebaseAuthProvider <- $firebaseAuth <- Auth
http://errors.angularjs.org/1.5.8/$injector/unpr?p0=%24firebaseAuthProvider%20%3C-%20%24firebaseAuth%20%3C-%20Auth(anonymous function) @ angular.js:68(anonymous function) @ angular.js:4511getService @ angular.js:4664(anonymous function) @ angular.js:4516getService @ angular.js:4664injectionArgs @ angular.js:4688invoke @ angular.js:4710enforcedReturnValue @ angular.js:4557invoke @ angular.js:4718(anonymous function) @ angular.js:4517getService @ angular.js:4664injectionArgs @ angular.js:4688invoke @ angular.js:4710(anonymous function) @ angular.js:4526forEach @ angular.js:321createInjector @ angular.js:4526doBootstrap @ angular.js:1758bootstrap @ angular.js:1779angularInit @ angular.js:1664(anonymous function) @ angular.js:31763fire @ jquery.js:3232fireWith @ jquery.js:3362ready @ jquery.js:3582completed @ jquery.js:3617

Of course I'm aware of all authentication methods changes that I need to do, but app crashes at very begining. Can't event get to the point that I can update my authentication methods. What can be problem? Tried to inspect execution step by step in chrome dev tools and seems it crashes right after loading all dependencies.

This is my auth module:

(function() {
  'use strict';
  angular.module('firebase.auth', ['firebase', 'firebase.ref'])

    .factory('Auth', ['$firebaseAuth','Ref', function($firebaseAuth,Ref) {
      return $firebaseAuth(firebase.auth());
    }]);
})();

This is my ref module that initializes app firebase connection

angular.module('firebase.ref', ['firebase'])
  .factory('Ref', ['$window', 'FBapiKey', 'FBauthDomain', 'FBdatabaseURL', 'FBstorageBucket', function($window, FBapiKey, FBauthDomain, FBdatabaseURL, FBstorageBucket) {
    'use strict';
    // Initialize Firebase
    var config = {
      apiKey: FBapiKey,
      authDomain: FBauthDomain,
      databaseURL: FBdatabaseURL,
      storageBucket: FBstorageBucket,
    };
    firebase.initializeApp(config);

    return firebase.database().ref();
  }]);

Tried to do many changes on these files - still same error - so i assume that problem can be in different place of my project.

Upvotes: 0

Views: 915

Answers (1)

yarpi87
yarpi87

Reputation: 113

Managed to resolve it!

As I supposed - problem was different and trivial (despite error message).

Seems that my module name conflicted with one module (with the same name) in angularfire. So only change to do was to change my auth module name (renamed it to firebase.appauth - and now it works! Still some other errors to fix due to upgrade process but app is loading.

(function() {
  'use strict';
  angular.module('firebase.appauth', ['firebase', 'firebase.ref'])

    .factory('Auth', ['$firebaseAuth','Ref', function($firebaseAuth,Ref) {
      return $firebaseAuth();
    }]);
})();

Upvotes: 4

Related Questions