Performance can only start when Firebase app instance is the default one

Viewed 233

I am using AngularFire and I want to add performance tracing metrics.

I have followed the instructions to add manual traces in this doc. I have added traces both through the AngularFirePerformance service and through the trace RxJS operator.

When I start my app, I get this error:

ERROR FirebaseError: Performance: Performance can only start when Firebase app instance is the default one. (performance/FB not default).
    at factoryMethod (https://auto-budget-app.web.app/firebase-performance-es2015.js:3083:33)
    at Component.instanceFactory (https://auto-budget-app.web.app/firebase-performance-es2015.js:3102:16)
    at Provider.push../node_modules/@firebase/component/dist/index.cjs.js.Provider.getOrInitializeService (https://auto-budget-app.web.app/vendor-es2015.js:130861:39)
    at Provider.push../node_modules/@firebase/component/dist/index.cjs.js.Provider.getImmediate (https://auto-budget-app.web.app/vendor-es2015.js:130762:33)
    at FirebaseAppImpl.push../node_modules/@firebase/app/dist/index.cjs.js.FirebaseAppImpl._getService (https://auto-budget-app.web.app/vendor-es2015.js:129485:49)
    at FirebaseAppImpl.firebaseAppImpl.<computed> [as performance] (https://auto-budget-app.web.app/vendor-es2015.js:129697:39)
    at https://auto-budget-app.web.app/vendor-es2015.js:79031:19
    at ZoneDelegate.invoke (https://auto-budget-app.web.app/polyfills-es2015.js:377:30)
    at Zone.run (https://auto-budget-app.web.app/polyfills-es2015.js:136:47)
    at NgZone.runOutsideAngular (https://auto-budget-app.web.app/vendor-es2015.js:70976:91)

I should only have one firebase app instance. I don't have a project called performance/FB. I have only found one other reference to this error on Google here, but the solution involves webpack and react. I am not using either of those, so this solution does not apply to me.

What is the cause of this error, how do I fix it?

1 Answers

I figured it out. In my app.module.ts imports, I had the following line:

    NgxAuthFirebaseUIModule.forRoot(environment.firebase, () => "my_app"),

Changing this to

    NgxAuthFirebaseUIModule.forRoot(environment.firebase),

fixed the issue.

Related