question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AngularFire is not compatible with Firebase JS SDK v8

See original GitHub issue

Version info

Angular: v10.2.0

Firebase: v8.0.0

AngularFire: v6.0.3

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';

Expected behavior

There should be no errors.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

11reactions
Reprevisecommented, Dec 17, 2020

I still can’t get auth and User by importing firebase/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

11reactions
sarunintcommented, Nov 1, 2020

@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:

https://unpkg.com/browse/@angular/fire@6.0.4/storage/observable/fromTask.d.ts

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade from version 8 to the modular Web SDK - Firebase
Apps currently using Firebase Web SDK version 8 or earlier should consider migrating to version 9 using the instructions in this guide.
Read more >
angular/fire - npm
NOTE: AngularFire is maintained by Googlers but is not a supported Firebase product.
Read more >
Upgrade to Firebase JS 8.0.0: Attempted import error: 'app' is ...
After upgrading to 8.0.0, I get the following error: Attempted import error: 'initializeApp' is not exported from 'firebase/app' (imported as ' ...
Read more >
@angular/fire | Yarn - Package Manager
AngularFire smooths over the rough edges an Angular developer might encounter when implementing the framework-agnostic Firebase JS SDK & aims to provide a ......
Read more >
export 'default' (imported as 'firebase') was not found in
According to the documentation, Apps currently using Firebase Web SDK ... was not found in '@firebase/app' I am using firebase V8.0.0 and @angular/fire...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found