• Register
0 votes
1.6k 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?

3.9k points

Please log in or register to answer this question.

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.

38.6k points

Related questions

0 votes
1 answer 14 views
14 views
Problem: Is there a way to get around this : Firebase app named '[default]' already exists?
asked May 27 Rada Gracelynn 100k points
0 votes
1 answer 3 views
3 views
Problem: In angularjs, a controller can be tested with
asked Jul 8 asha 117k points
0 votes
1 answer 32 views
32 views
Problem: I need help with this : Internal exception io netty handler timeout readtimeoutexception .
asked Mar 20 PkGuy 25.9k points
0 votes
1 answer 143 views
143 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 Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 2.1k views
2.1k 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
0 votes
1 answer 5 views
5 views
Problem: Has anyone had this complication before : Authentication failed failed to authenticate with google?
asked Jun 24 Chi Omega 166k points
0 votes
1 answer 36 views
36 views
Problem: Where can I get assistance: Firebase onmessagereceived not called when app in background?
asked Jun 22 akhi 121k points
0 votes
1 answer 13 views
13 views
Problem: I have implemented Firebase notification in my Android application. When my app is running, notification is displayed with my custom layout, but when application is not running, the notification is displayed with the default layout. How can I change the notification layout to my layout when application is not running?
asked Apr 12 muktaa 34.6k points
0 votes
1 answer 6 views
6 views
Problem: Can not load chrome it is not registered?
asked Jul 18 Mezbah 125k points
0 votes
1 answer 14 views
14 views
Problem: Could not build objective-c module 'firebase'.
asked Jul 8 Florina Gulnar 103k points