• Register
0 votes
748 views

Problem :

Currently I am trying to unit test while developing the simple web with AngularJS + Firebase, but I have the problem defining my spec and trying a test runner

My Error:

PhantomJS 2.1.1 (Mac OS X 0.0.0) Controller: MainCtrl should.... FAILED
Error: [$injector:modulerr] Failed to instantiate module MainApp due 
to: Firebase: Firebase App named '[DEFAULT]' already exists 
(app/duplicateapp).

But, defining my spec once is not the problem. For example:

it('should....',function(){
   expect(true).toBe(true)
})

But now I am unable to know why this error is occurring.  Please let me know how to fix the above error in short time?

7 5 2
3,870 points

1 Answer

0 votes

Solution :


I had the same issue in the recent past using firebase, and I discovered that I was initializing my firebase twice, example:

function initializeFirebase(){    
 var config = {
    apiKey: "myApiKey",
    authDomain: "myAuthDomain",
    databaseURL: "myDatabaseUrl",
    storageBucket: "myStorageBocket",
    messagingSenderId: "idhere"   
   };   
   //initialize firebase  
   firebase.initializeApp(config);  
}

In my case I was using the react, And I was calling a initializeFirebase() from two different components, but I have decided to call it only from the parent component. And now I am able to query the database, insert records, remove, can do all the operations on my database..

Hope this helps you in fixing your error.

9 7 4
38,600 points

Related questions

0 votes
1 answer 922 views
922 views
Problem : I am facing following Jasmine issue and looking for solution: async callback was not invoked within timeout specified by jasmine.default_timeout_interval.
asked Nov 16, 2019 peterlaw 6.9k points
1 vote
1 answer 99 views
99 views
Problem : I am very beginner to Android and Firebase. I am taking help of tutorials to learn Android Programming. I am trying to add the Firebase-database to my Android application and I am facing below error: FAILURE: Build failed with an exception. ·         What went ... to get full insights. I am stuck with above Android error. Need some expert who can help me in fixing above Android error.
asked May 16 Martin K 6.6k points
0 votes
1 answer 8 views
8 views
Problem: hello fellow developers, I am working on a Firebase messaging application on my Xcode 11, and the Swift version is 5. I really need your help as I am stuck on an issue and this is giving me a headache. Kindly help me to resolve this issue.
asked Oct 12 SapperIt 830 points
1 vote
1 answer 788 views
788 views
Problem: I have elementary knowledge of Android. Currently I am working on the android app. My app currently uses Firebase Authentication, Database and Storage. It was completely working as expected until I face the error message as shown below in logcat. E/ ... stuff. I have the latest Google-Services.json file from the Firebase Console but it is not making any difference at all.
asked Jun 8 Martin K 6.6k points