After the recent updates (I update regularly), I am getting following error while running the application. Project is created with Angular CLI. As of now, no build errors.

`import { User } from './../models/user.model';
import { Observable, Observer } from 'rxjs';
import { Injectable } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { auth } from 'firebase/app';
@Injectable({
providedIn: 'root'
})
export class AuthService {
user: User = {
name: '',
email: '',
photo: '',
token: {
value: '',
uid: '',
createdOn: '',
expiredOn: '',
isAuthenticated: false,
isAdmin: false
}
};
constructor(public afAuth: AngularFireAuth) { }
observable$ = Observable.create((observer) => {
try {
this.getUserDetails();
observer.next(this.user);
} catch {
this.resetUserData();
observer.error();
} finally {
observer.complete();
}
});
getAuthUser(): Observable
return this.observable$;
}
login(): User | void {
this.afAuth.auth.setPersistence(auth.Auth.Persistence.SESSION);
this.afAuth.auth.signInWithPopup(new auth.GoogleAuthProvider())
.then((user) => {
if (user) {
this.getUserDetails();
}
})
.catch((error) => {
this.resetUserData();
console.error(error);
});
return this.user;
}
logout(): void {
this.afAuth.auth.signOut()
.then(() => {
this.resetUserData();
})
.catch(
response => console.error('Error Occured While Logging Out' + response)
);
}
getUserDetails(): User | void {
this.afAuth.auth.onAuthStateChanged((currentUser) => {
if (currentUser) {
this.user.name = currentUser.displayName;
this.user.email = currentUser.email;
this.user.photo = currentUser.photoURL;
this.getUserToken();
} else {
this.resetUserData();
console.error('No user present. Please login');
}
});
return this.user;
}
async getUserToken(): Promise
await this.afAuth.auth.currentUser.getIdTokenResult()
.then((token) => {
if (token) {
this.user.token.value = token.token ? token.token : '';
this.user.token.createdOn = token.issuedAtTime ? token.issuedAtTime : '';
this.user.token.expiredOn = token.expirationTime ? token.expirationTime : '';
this.user.token.uid = token.claims ? (token.claims.user_id ? token.claims.user_id : '') : '';
this.user.token.isAuthenticated = this.isAuthenticated();
}
})
.catch(() => {
this.resetUserData();
console.error('error while getting the token');
});
}
isAuthenticated(): boolean {
if (this.user.token.createdOn && this.user.token.expiredOn) {
const expiryTime = new Date(this.user.token.expiredOn).getTime();
const creationTime = new Date(this.user.token.createdOn).getTime();
const currentTime = new Date().getTime();
if (expiryTime > creationTime && expiryTime > currentTime) {
return true;
} else {
console.error('Evicting Unauthenticated user');
this.logout();
return false;
}
} else {
console.error('Evicting Unauthenticated user');
this.logout();
return false;
}
}
resetUserData(): User | void {
this.user = {
name: '',
email: '',
photo: '',
token: {
value: '',
uid: '',
createdOn: '',
expiredOn: '',
isAuthenticated: false,
isAdmin: false
}
};
return this.user;
}
}
`
AppComponent.html:1 ERROR TypeError: app.auth is not a function
at auth.js:24
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:7929)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (polyfills.js:7688)
at NgZone.push../node_modules/@angular/core/fesm5/core.js.NgZone.runOutsideAngular (core.js:17258)
at new AngularFireAuth (auth.js:22)
at createClass (core.js:21273)
at createProviderInstance (core.js:21235)
at resolveNgModuleDep (core.js:21199)
at NgModuleRef.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef.get (core.js:21907)
at resolveDep (core.js:22278)
AppComponent.html:1 ERROR CONTEXT DebugContext_ {view: {…}, nodeIndex: 1, nodeDef: {…}, elDef: {…}, elView: {…}}
View_AppComponent_0 @ AppComponent.html:1
proxyClass @ compiler.js:18239
push../node_modules/@angular/core/fesm5/core.js.DebugContext_.logError @ core.js:24139
push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:15777
(anonymous) @ core.js:17870
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:391
push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:150
push../node_modules/@angular/core/fesm5/core.js.NgZone.runOutsideAngular @ core.js:17258
(anonymous) @ core.js:17870
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:391
onInvoke @ core.js:17299
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:390
push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:150
(anonymous) @ zone.js:889
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:423
onInvokeTask @ core.js:17290
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:422
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:195
drainMicroTaskQueue @ zone.js:601
Promise.then (async)
scheduleMicroTask @ zone.js:584
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:413
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ zone.js:258
scheduleResolveOrReject @ zone.js:879
ZoneAwarePromise.then @ zone.js:1012
push../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule @ core.js:17803
./src/main.ts @ main.ts:14
__webpack_require__ @ runtime.js:84
0 @ polyfills.ts:81
__webpack_require__ @ runtime.js:84
checkDeferredModules @ runtime.js:46
webpackJsonpCallback @ runtime.js:33
(anonymous) @ main.js:1
"dependencies": {
"@angular/animations": "^7.2.15",
"@angular/cdk": "^7.3.7",
"@angular/common": "^7.2.15",
"@angular/compiler": "^7.2.15",
"@angular/core": "^7.2.15",
"@angular/fire": "^5.1.3",
"@angular/flex-layout": "^7.0.0-beta.24",
"@angular/forms": "^7.2.15",
"@angular/http": "^7.2.15",
"@angular/material": "^7.3.7",
"@angular/platform-browser": "^7.2.15",
"@angular/platform-browser-dynamic": "^7.2.15",
"@angular/pwa": "^0.13.9",
"@angular/router": "^7.2.15",
"@angular/service-worker": "^7.2.15",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^7.4.0",
"@ngrx/entity": "^7.4.0",
"@ngrx/router-store": "^7.4.0",
"@ngrx/schematics": "^7.4.0",
"@ngrx/store": "^7.4.0",
"@ngrx/store-devtools": "^7.4.0",
"@trademe/ng-defer-load": "^2.0.0",
"@types/angular": "^1.6.54",
"@types/angular-material": "^1.1.68",
"@types/firebase-client": "^0.1.32",
"@types/firebase-token-generator": "^2.0.28",
"classlist.js": "^1.1.20150312",
"core-js": "^2.6.5",
"firebase": "^6.0.2",
"firebase-admin": "^6.5.1",
"firebase-functions": "^2.3.1",
"firebase-tools": "^6.9.2",
"hammerjs": "^2.0.8",
"node-sass": "^4.12.0",
"rxjs": "^6.5.2",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.29"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.13.9",
"@angular/cli": "^7.3.9",
"@angular/compiler-cli": "^7.2.15",
"@angular/language-service": "^7.2.15",
"@types/jasmine": "^3.3.12",
"@types/jasminewd2": "^2.0.6",
"@types/node": "^10.14.6",
"codelyzer": "^4.5.0",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.1.4",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "^5.4.2",
"ts-node": "~7.0.1",
"tslint": "~5.11.0",
"tslint-angular": "^1.1.2",
"types-installer": "^1.6.3",
"typescript": "^3.2.4"
}
I'm not able to reproduce the issue, though I didn't use @angluar/fire.
Can you show me how you import and initialize firebase and auth?
Better yet, can you create a minimal repro?
Dear @Feiyang1 ,
I have updated the main issue with latest details. Along with that below is the code for my Auth Service by which I am importing firebase. This only got broke when the firebase got updated. My working code from master is available at - https://angular6-201.firebaseapp.com/dashboard
`import { User } from './../models/user.model';
import { Observable, Observer } from 'rxjs';
import { Injectable } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { auth } from 'firebase/app';
@Injectable({
providedIn: 'root'
})
export class AuthService {
user: User = {
name: '',
email: '',
photo: '',
token: {
value: '',
uid: '',
createdOn: '',
expiredOn: '',
isAuthenticated: false,
isAdmin: false
}
};
constructor(public afAuth: AngularFireAuth) { }
observable$ = Observable.create((observer) => {
try {
this.getUserDetails();
observer.next(this.user);
} catch {
this.resetUserData();
observer.error();
} finally {
observer.complete();
}
});
getAuthUser(): Observable
return this.observable$;
}
login(): User | void {
this.afAuth.auth.setPersistence(auth.Auth.Persistence.SESSION);
this.afAuth.auth.signInWithPopup(new auth.GoogleAuthProvider())
.then((user) => {
if (user) {
this.getUserDetails();
}
})
.catch((error) => {
this.resetUserData();
console.error(error);
});
return this.user;
}
logout(): void {
this.afAuth.auth.signOut()
.then(() => {
this.resetUserData();
})
.catch(
response => console.error('Error Occured While Logging Out' + response)
);
}
getUserDetails(): User | void {
this.afAuth.auth.onAuthStateChanged((currentUser) => {
if (currentUser) {
this.user.name = currentUser.displayName;
this.user.email = currentUser.email;
this.user.photo = currentUser.photoURL;
this.getUserToken();
} else {
this.resetUserData();
console.error('No user present. Please login');
}
});
return this.user;
}
async getUserToken(): Promise
await this.afAuth.auth.currentUser.getIdTokenResult()
.then((token) => {
if (token) {
this.user.token.value = token.token ? token.token : '';
this.user.token.createdOn = token.issuedAtTime ? token.issuedAtTime : '';
this.user.token.expiredOn = token.expirationTime ? token.expirationTime : '';
this.user.token.uid = token.claims ? (token.claims.user_id ? token.claims.user_id : '') : '';
this.user.token.isAuthenticated = this.isAuthenticated();
}
})
.catch(() => {
this.resetUserData();
console.error('error while getting the token');
});
}
isAuthenticated(): boolean {
if (this.user.token.createdOn && this.user.token.expiredOn) {
const expiryTime = new Date(this.user.token.expiredOn).getTime();
const creationTime = new Date(this.user.token.createdOn).getTime();
const currentTime = new Date().getTime();
if (expiryTime > creationTime && expiryTime > currentTime) {
return true;
} else {
console.error('Evicting Unauthenticated user');
this.logout();
return false;
}
} else {
console.error('Evicting Unauthenticated user');
this.logout();
return false;
}
}
resetUserData(): User | void {
this.user = {
name: '',
email: '',
photo: '',
token: {
value: '',
uid: '',
createdOn: '',
expiredOn: '',
isAuthenticated: false,
isAdmin: false
}
};
return this.user;
}
}
`
I created a fresh angularfire project with auth using the steps here: https://github.com/angular/angularfire2/blob/master/docs/auth/getting-started.md
It seemed to work, I wasn't able to reproduce the error.
I went to the url you provided above, which seems to be your deployed project, and it seems to be working. Did you get this working since you last posted, or is that an older version that's deployed?
If it's still not working, can you share the code for initializing your app, such as:
AngularFireModule.initializeApp(environment.firebase)
Thanks!
Dear @hsubox76 ,
AngularFireModule.initializeApp(environment.firebase, 'angular6-201'),Thank You
Regards
Unfortunately, I still can't seem to reproduce it. Can you create a bare-bones repo that reproduces this error? I've made a minimal AngularFire project repo here (that does not show the error): https://github.com/hsubox76/angularfire-test
It is a fully functional repo except for your Firebase config (API key, etc.) needing to be pasted into environment.ts.
Can you either clone that repo and cause it to fail, or strip down your own code (remove anything proprietary or private) to create a similar minimal repo that fails? This would be the best way for us to narrow down what's wrong. And if you're able to make that, then can you give us a link to the source code (Github repo)? The link above (https://angular6-201.firebaseapp.com/dashboard) seems to be to a deployment, not code.
I've fixed with this comment
https://github.com/firebase/firebase-js-sdk/issues/752#issuecomment-389605982
I was previously using:
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
and needed to change this to:
import firebase from "@firebase/app";
import "@firebase/auth";
import "@firebase/firestore";
This actually didn't fix my issue. I'm still having the same issue as you where auth is not a member of firebase. Downgrading to 5.11.1 at the moment solves it for me until I can look into it further.
Dear @curtgrimes,
Thank You for your effort to look into my issue. Unfortunately it is still unresolved.
ERROR in src/app/services/auth.service.ts(44,46): error TS2339: Property 'Auth' does not exist on type 'FirebaseNamespace'.
src/app/services/auth.service.ts(45,51): error TS2339: Property 'GoogleAuthProvider' does not exist on type 'FirebaseNamespace'.
Also whenever I am installing firebase or running "npm update" using "npm i firebase" (as per npmjs) after deleting folder in node_modules, it is loading tons of .c and .cc files and trying to build which it is eventually failing. I have node gyp, python 2.7 and MS VS Build Tool 2017 installed.
Maybe total noob in this, but this is not something proper. never happened earlier in this way, i keep updating my app because that is one of the requirement from app owner.
I seriously need help because my app is now messed up.
Thank You
Regards
Ramen
This actually didn't fix my issue. I'm still having the same issue as you where auth is not a member of firebase. Downgrading to 5.11.1 at the moment solves it for me until I can look into it further.
Dear @curtgrimes,
I was using v5.11.1 and problem started from that time.
Thank You
Regards
Updated to Firebase SDK version: v6.0.2 but the issue is still there.
It looks like this issue is caused by the firebase-admin package being installed in the same project using the firebase JS SDK.
Dear @curtgrimes ,
Tried by removing that also. Not working :(
Thank You
Regards
I'm afraid it's too difficult to pinpoint the exact problem without getting a look at the rest of your setup. Can you please provide a minimal repro as described in the above comment? Once you've created it, you can upload it to a public Github repo and I'll clone it and try to debug.
It should look something like the example repo I linked above - complete but minimal, except that it results in the errors you're seeing.
I'm having this problem too, in node. I've been using both the admin and client sdks together, for example to create a custom token and then login with it, especially for testing.
Since updating to 6.1.1 from 5.5.9, auth is no longer on the firebase sdk namespace.
See clientForUser() here https://github.com/buzzware/firebase-extra/blob/master/src/FirebaseExtraAdmin.js
I'm experiencing this issue as well, and it's very frustrating because I've worked for months and am finally ready to deploy my app and I'm hitting these firebase errors. I have had no errors surface until the prod deploy of my app. Also this error is only occurring for me in the deployed prod app with server-side rendering. I am seeing it occurs in firebase serve as well. My setup:
Angular app:
"@angular/core": "~7.1.0",
"@angular/fire": "^5.1.3",
"firebase": "^5.11.1",
functions:
"firebase": "^5.11.1",
"firebase-admin": "^7.4.0",
"firebase-functions": "^2.3.1",
The "app.auth is not a function" error _does not occur_ if you uninstall firebase from functions. In fact I never had firebase installed in functions and everything seemed to work fine until I deployed and ran into an error with my ssr: Cannot find module 'firebase/app'. (issue)
It's a little worrisom that someone in this thread said they fixed the issue by installing firebase packages in the right order. Are there possibly circular dependencies? A lot of people are saying they deleted package-lock.json and node_modules and reinstalled which seems like some patches were shipped since they last installed and maybe fixed issues. Is there a changelog somewhere? I couldn't find it.
Hi @hsubox76, I forked your test repo to try and reproduce the issue. I added Universal and got it working with firebase functions, so you can run firebase serve and the app is rendered by a firebase function. There are no errors. Here is the repo: https://github.com/inorganik/angularfire-test
The biggest difference I can find between this test repo and my project is that the test repo _doesn't_ have the firebase package installed in the functions directory.
My project didn't either, but then I got this issue: https://github.com/firebase/firebase-js-sdk/issues/1250 which I tried to fix by adding the firebase package to functions.
I think the fix for _this_ issue is to remove the firebase package from functions, but I'm not sure what causes the other issue. Hope this helps, please let us know if you have any insight.
@hsubox76 As expected, once I deployed my test app, I get the firebase module error. I deployed it here:
https://hometowns-angularfire.firebaseapp.com/
which only renders "Error: could not handle the request"
This is the repo: https://github.com/inorganik/angularfire-test
Firebase function logs show the error:
Error: Cannot find module 'firebase/app'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at webpackUniversalModuleDefinition (/user_code/dist/angularfire-test-webpack/server.js:3:28)
at Object.<anonymous> (/user_code/dist/angularfire-test-webpack/server.js:10:3)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
But there are cases where you need the firebase package in functions:
1) writing tests in node for permissions or authentication related things
2) to generate a custom id token. Perhaps there is a new way using only
admin? How?
3) things you and i haven't thought of. It works in 5.x, why stop
supporting it?
On Tue, 11 Jun 2019, 11:52 PM Jamie Perkins notifications@github.com
wrote:
Hi @hsubox76 https://github.com/hsubox76, I forked your test repo to
try and reproduce the issue. I added Universal and got it working with
firebase functions, so you can run firebase serve and the app is rendered
by a firebase function. Here is the repo:
https://github.com/inorganik/angularfire-testThe biggest difference I can find between this test repo and my project is
that the test repo doesn't have the firebase package installed in the
functions directory.My project didn't either, but then I got this issue: #1250
https://github.com/firebase/firebase-js-sdk/issues/1250I think the fix for this issue is to remove the firebase package from
functions, but I'm not sure what causes the other issue. Hope this helps,
please let us know if you have any insight.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-js-sdk/issues/1696?email_source=notifications&email_token=AAAG47KRO3M7QBJXLESCMXLPZ7C2VA5CNFSM4HFXGC7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXNTHUA#issuecomment-500904912,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAG47PNG5XKTF2JNEKR4HLPZ7C2VANCNFSM4HFXGC7A
.
Dear @inorganik,
I know the feeling. My year old app is also broken. :( Hope we all find the solution to this fast.
Regards
firebase-admin and firebase both depend on @firebase/app. When you include them as dependencies, it's very likely that they are not compatible, in the sense that they depend on different versions of @firebase/app, which results in 2 @firebase/app installed in node_modules. It will work or not work depending on which @firebase/app is hoisted by npm (It will work if @firebase/app from firebase is hoisted). That's why someone mentioned installing firebase first, then firebase-admin next solves the issue. In other words, it doesn't work because firebase/auth registered with the wrong @firebase/app instance.
There are 3 options to solve the problem:
firebase-admin and firebase depend on the exact same version of @firebase/app. The following combinations work as of today:firebase-admin 7.x and 8.x with firebase 5.11.1firebase first, firebase-admin next. I wouldn't recommend it though.firebase in an environment where firebase-admin is not present, then you should be able to execute the bundled code along side firebase-admin with no problem, e.g. in firebase functions.It seems many people ran into this problem, so we will look into long term solution that makes this use case less error prone. @hiranya911 Let's talk about it.
@Feiyang1 thanks for your detailed response, and it is working for me with firebase 5.11.1 like you say.
Long term, I think firebase-admin should offer a complete superset of firebase, if it is not feasible to maintain the ability to install both. If that is not feasible, then please provide solutions for firebase-admin to
1) login as a user with the same limited permissions, for testing security rules
2) user.getIdToken()
3) other things missing from firebase-admin I'm not aware of.
@inorganik in your repo https://github.com/inorganik/angularfire-test, firebase packages are excluded in the bundle since you made firebase packages external dependencies in the webpack config. You need to list firebase as a dependency in the package.json under functions folder, so node can find it at runtime.
Installing firebase in my functions folder at v 5.11.1 fixed this issue for me. Thanks @Feiyang1 !
It seems clear now the issue is understanding which versions of firebase are compatible with each other. Having major versions synced up would be nice. At the very least can we have a REAME that shows compatible versions of everything? It would save us a lot of pain and suffering.
Closing since it seems the issue has been resolved.
@Feiyang1 I don't think it is resolved. The fact that you need to select particular version combinations of the two will cause headaches for new users, and closing this suggests Google is ok with it not being reliable to use the firebase package in node (which there are good reasons for doing). If I build my product based on this, will I be at risk in the future of not being able to upgrade, because there is no pair of versions that works? e.g. currently, I'm stuck on 5.x
Dear @Feiyang1 ,
Closing without a proper/stable solution is unfair. Don't you think?
Thank You
Regards
@buzzware @ramen-mukherjee
Any version of firebase and firebase-admin will work together after [email protected] and [email protected].
@Feiyang1 your above comment doesn't seem to work for me.
I have the following package versions and the functions emulator work as expected:
"firebase": "6.3.5",
"firebase-admin": "8.3.0",
"firebase-functions": "3.2.0",
"firebase-tools": "7.2.3",
If I update the firebase package to 6.4.0 and run the emulator, it reports the following error:
FirebaseError: Firebase: Firebase service named 'database' already registered (app/duplicate-service).
@donaldaverill please take a look at the conversation in https://github.com/firebase/firebase-js-sdk/issues/2054
Thank you @Feiyang1. Yes, I've read through that thread a few times. I'm not importing or requiring anything directly from the firebase package. This is happening in firebase functions (and emulator) but only with firebase 6.4.0. Version 6.3.5 works fine. Also, I'm initializing the app by
import * as admin from 'firebase-admin'
admin.initializeApp()
Does that seem okay?
That looks fine. I don't see any change in 6.4.0 that could cause the issue.
If you don't use firebase package in functions, can you remove it from package.json and try again?
@Feiyang1 As it turns out, I don't need the firebase package for the firebase functions, but I have other apps in my repo that require firebase. I think I may be running into this issue: https://github.com/firebase/firebase-js-sdk/issues/1696#issuecomment-501546596. firebase 6.3.5 seems to be a valid combo with the other firebase packages (listed above) but not 6.4.0 for whatever reason. Note that I always remove package-lock.json and node_modules folder before running npm install again.
https://github.com/firebase/firebase-js-sdk/issues/1696#issuecomment-501546596 describes a different issue than yours.
The issue is that firebase-admin and firebase-functions both imports @firebase/database (firebase-functions depends on firebase-admin). It's not a problem if firebase is not present, but since it is, there are 2 attempts to register database with firebase, thus the error.
Do you have separate package.json for the main app and functions? something like:
- your-app
- functions
- package.json
- src
- package.json
then you can remove firebase from functions's package.json.
And we are removing this error (app/duplicate-service) in the next version of the SDK, so duplicate service registering will just be ignored.
Thanks again @Feiyang1
#1696 (comment) describes a different issue than yours.
The issue is that
firebase-adminandfirebase-functionsboth imports@firebase/database(firebase-functionsdepends onfirebase-admin). It's not a problem iffirebaseis not present, but since it is, there are 2 attempts to registerdatabasewithfirebase, thus the error.
Ok, makes sense.
Do you have separate
package.jsonfor the main app and functions? something like:- your-app - functions - package.json - src - package.jsonthen you can remove
firebasefrom functions's package.json.
I have one package.json. Additionally, one of my functions is an Angular Universal app that includes AngularFire. This function/universal app has broken as well due to the (app/duplicate-service) issue.
I see. I still don't understand why 6.3.5 works though. Anyway, a new version will come out later today that won't cause this issue anymore.
@Feiyang1 firebase 6.4.1 has fixed my issues for the functions build, emulator, and Angular Universal app. 👍👍
Most helpful comment
@Feiyang1 your above comment doesn't seem to work for me.