You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AngularFire is not compatible with Firebase JS SDK v8 #2619
Other (e.g. Ionic/Cordova, Node, browser, operating system):
Debug output
ERROR in node_modules/@angular/fire/auth/auth.d.ts:4:10 - error TS2614: Module '"../../../firebase"' has no exported member 'User'. Did you mean to use 'import User from "../../../firebase"' instead?
4 import { User, auth } from 'firebase/app';
~~~~
node_modules/@angular/fire/auth/auth.d.ts:4:16 - error TS2614: Module '"../../../firebase"' has no exported member 'auth'. Did you mean to use 'import auth from "../../../firebase"' instead?
4 import { User, auth } from 'firebase/app';
@jamesdaniels Sorry for the absence. I tested 6.0.4 with firebase@7 and it does not work. In firebase@8 it does work though.
Here's my analysis.
In firebase@7, the firebase is export as such:
export=firebase;
So, to be able to use import firebase from 'firebase'; in AngularFire's codebase, the user needs to have allowSyntheticDefaultImports set as true in their tsconfig.json.
But in 6.0.4 type definition, there is one line that is problematic. Here:
The import("firebase").default.storage.UploadTaskSnapshot does not play very well with "allowSyntheticDefaultImports": true. Hence, there is this error while building a project with 6.0.4 and firebase@7:
ERROR in node_modules/@angular/fire/storage/observable/fromTask.d.ts:3:83 - error TS2694: Namespace 'firebase' has no exported member 'default'.
3 export declare function fromTask(task: UploadTask): Observable<import("firebase").default.storage.UploadTaskSnapshot>;
Please take a look. I'm not sure why the generated .d.ts is using the import() type syntax, though.
Reacted by Marius, Jean-benoit Gautier, WouterVandenputte, Innovative Thinking, Masahiro Hayashi, Dariusz Fark, 1001 Days of Code, Josh White and Ivan Navarro
@jamesdaniels Sorry for the absence. I tested 6.0.4 with firebase@7 and it does not work. In firebase@8 it does work though.
Here's my analysis.
In firebase@7, the firebase is export as such:
export=firebase;
So, to be able to use import firebase from 'firebase'; in AngularFire's codebase, the user needs to have allowSyntheticDefaultImports set as true in their tsconfig.json.
But in 6.0.4 type definition, there is one line that is problematic. Here:
The import("firebase").default.storage.UploadTaskSnapshot does not play very well with "allowSyntheticDefaultImports": true. Hence, there is this error while building a project with 6.0.4 and firebase@7:
ERROR in node_modules/@angular/fire/storage/observable/fromTask.d.ts:3:83 - error TS2694: Namespace 'firebase' has no exported member 'default'.
3 export declare function fromTask(task: UploadTask): Observable<import("firebase").default.storage.UploadTaskSnapshot>;
Please take a look. I'm not sure why the generated .d.ts is using the import() type syntax, though.
You need to know now from version 8 you can import just the services you use:
// This import loads the firebase namespace along with all its type information.importfirebasefrom'firebase/app';// These imports load individual services into the firebase namespace.import'firebase/auth';import'firebase/database';
Activity
jamesdaniels commentedon Oct 30, 2020
Give
6.0.4-canary.9a26fbea spin, I'll be releasing6.0.4final shortly.jamesdaniels commentedon Oct 30, 2020
Releasing
6.0.4with support for v8 later today.sarunint commentedon Nov 1, 2020
@jamesdaniels Sorry for the absence. I tested
6.0.4withfirebase@7and it does not work. Infirebase@8it does work though.Here's my analysis.
In
firebase@7, thefirebaseis export as such:So, to be able to use
import firebase from 'firebase';in AngularFire's codebase, the user needs to haveallowSyntheticDefaultImportsset astruein theirtsconfig.json.But in
6.0.4type definition, there is one line that is problematic. Here:https://unpkg.com/browse/@angular/fire@6.0.4/storage/observable/fromTask.d.ts
The
import("firebase").default.storage.UploadTaskSnapshotdoes not play very well with"allowSyntheticDefaultImports": true. Hence, there is this error while building a project with6.0.4andfirebase@7:Please take a look. I'm not sure why the generated
.d.tsis using theimport()type syntax, though.dusanradojcic00 commentedon Nov 20, 2020
I am still having the same problem. Angular version 11.0.2 and AngularFire version 6.1.1
jamesdaniels commentedon Nov 20, 2020
Drop angularfire2, that's no longer maintained and looks like it's wrapping an old version of
@angular/firedusanradojcic00 commentedon Nov 20, 2020
Yeah. It works now, thanks!
wizjamin commentedon Nov 26, 2020
@dusanradojcic00 how'd you get it working??. I'm using angularfire v6.1.2 and i'm still getting those errors
dusanradojcic00 commentedon Nov 26, 2020
@wizjamin remove angularfire2, that's what worked for me. Check all dependencies and imports inside NgModule.
IvanNavarroCode commentedon Dec 11, 2020
Fixed in 6.1.4 by #2703.
Reprevise commentedon Dec 17, 2020
I still can't get
authandUserby importingfirebase/app. It just says it doesn't have an exported member User and auth.firebase version: 8.2.0
AngularFire version: 6.1.4
Angular version: 11.0.5
eduardovpessoa commentedon Dec 21, 2020
@Reprevise same here! =(
shadowboxingskills commentedon Dec 21, 2020
same issue.
authhas apparently been removedVillanuevand commentedon Dec 21, 2020
@Reprevise @eduardovpessoa @shadowboxingskills
You need to know now from version 8 you can import just the services you use:
You can read more about here
jamesdaniels commentedon Dec 21, 2020
You have to use the full form
firebase.auth.Userin v8, can't shorthand it asauth.UserQuentinFarizon commentedon Dec 22, 2020
I have :
I can use
firebase.Userbut notfirebase.auth.User...jamesdaniels commentedon Dec 22, 2020
Ah yeah, they just changed the API in v8 firebase.User is the same thing auth.User used to be.
AlexanderLea commentedon Feb 22, 2021
For those - like me - who arrive here from Google: the docs have a pretty concise summary (https://github.com/angular/angularfire/blob/master/docs/auth/getting-started.md)
syslogic commentedon Aug 23, 2021
Auth&Usercan now be accessed alike: