• Register
0 votes

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 

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


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

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  

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 1.4K 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 3 views
Problem: all firebase libraries must be either above or below 14.0.0
asked Feb 18 Ethan ross 1.8k points
0 votes
1 answer 10 views
Problem com.google.firebase.auth.firebaseauth is not linked. skipping initialization.
asked Feb 9 charles mathews 3.8k points
1 vote
1 answer 349 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, 2020 Martin K 6.6k points
0 votes
1 answer 19 views
I am new to this. I just want to know how to do that?
asked Nov 30, 2020 TeamScript 13.5k points
0 votes
1 answer 5 views
Problem: invalid setup on a non-virtual (overridable in vb) member.
asked 2 days ago Dan phillip 1.9k points
0 votes
1 answer 24 views
Problem:- hey, we are working on a student portal system and we need to test it.As we don't have professional QA So we would like to adopt QA responsibilities and skills.
asked Oct 2, 2020 SapperIt 1.2k points
1 vote
1 answer 362 views
Problem: I have very recently started understanding salesforce. I want to catch the exception which gets thrown in my @myfuture mymethod nevertheless my test mymethod is unable to detecting it. Please find below my class under test for your reference: public with ... Mymethods defined as TestMymethod do not support Web service callouts, test skipped Please help me in unit testing my above code.
asked May 29, 2020 Martin K 6.6k points
0 votes
1 answer 748 views
Problem : I have got the following gradle FAILURE message: ..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0." My Case description as follows: · I had attached to the project codebase the next libs: APP/build. ... test and got the FAILURE message as follows. Deprecated gradle features were used in this build, making it incompatible with gradle 5.0.
asked Nov 21, 2019 peterlaw 6.9k points