Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase-core]: Unable to Initialize Firebase App #154

Open
kyao-Frndz opened this issue Nov 7, 2022 · 3 comments
Open

[firebase-core]: Unable to Initialize Firebase App #154

kyao-Frndz opened this issue Nov 7, 2022 · 3 comments

Comments

@kyao-Frndz
Copy link

Hello Team,
Can you assist with the error below, when trying to initialize the firebase app from the firebase-core?
Here is how I am initializing it

export class AppComponent implements OnInit {

    ngOnInit(): void {
        firebase().initializeApp().then((app) => {
            console.log(app);
        })
    }

}

Here is the error that shows up

JS: Error: Cannot read property 'FirebaseApp' of undefined
JS:     at file: src/webpack:/testapp/node_modules/@nativescript/firebase-core/index.android.js:295:0
JS:     at new ZoneAwarePromise (file: src/webpack:/testapp/node_modules/zone.js/fesm2015/zone.js:1429:0)
JS:     at Firebase.initializeApp (file: src/webpack:/testapp/node_modules/@nativescript/firebase-core/index.android.js:234:0)
JS:     at AppComponent.ngOnInit (file: src/webpack:/testapp/src/app/app.component.ts:6:16)
JS:     at callHook (file: src/webpack:/testapp/node_modules/@angular/core/fesm2015/core.mjs:2491:0)
JS:     at callHooks (file: src/webpack:/testapp/node_modules/@angular/core/fesm2015/core.mjs:2460:0)
JS:     at executeInitAndCheckHooks (file: src/webpack:/testapp/node_modules/@angular/core/fesm2015/core.mjs:2411:0)
JS:     at refreshView (file: src/webpack:/testapp/node_modules/@angular/core/fesm2015/core.mjs:11971:0)
JS:     at detectChangesInternal (file: src/webpack:/testapp/node_modules/@angular/core/fesm2015/core.mjs:13174:0)
JS:     at RootViewRef.detectChanges (file:///data/data/org.nativescript.testapp/fi...
@triniwiz
Copy link
Member

triniwiz commented Nov 7, 2022

Can you try installing one of the other firebase packages e.g firebase-analytics

@Ederagp
Copy link

Ederagp commented Dec 9, 2022

hello,
Something similar happens to me, not the same error but in the same initalizeApp().

ERROR:

Unhandled Promise rejection: Default app has already been configured. ; Zone: <root> ; Task: Promise.then ; Value: Error: Default app has already been configured. Error: Default app has already been configured. at initApp (file: node_modules/@nativescript/firebase-core/index.ios.js:393:0) at file: node_modules/@nativescript/firebase-core/index.ios.js:402:0 at new ZoneAwarePromise (file: node_modules/zone.js/fesm2015/zone.js:1429:0) at Firebase.initializeApp (file: node_modules/@nativescript/firebase-core/index.ios.js:312:0) at Module../app/main.ts (file: app/main.ts:9:0) at __webpack_require__ (file: app/webpack/bootstrap:24:0) at Object._requireSelf [as require] (file: app/webpack/runtime/hot module replacement:102:0) at Object.apply (file: app/webpack/runtime/require chunk loading:401:0) at file: app/webpack/runtime/hot module replacement:344:0 at Array.forEach (<anonymous>)

MacBook Pro M1
package.json:
"@nativescript/core": "~8.3.4",
"@nativescript/datetimepicker": "~2.1.11",
"@nativescript/firebase": "~11.1.3",
"@nativescript/firebase-core": "~2.3.4",
"@nativescript/firebase-messaging": "~2.3.4",

@triniwiz
Copy link
Member

You need to remove @nativescript/firebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants