Search code examples
angulartypescriptfirebasegoogle-cloud-firestoreangularfire

AngularFire after update throws ERROR FirebaseError: Expected type 'Ea', but it was: a custom Ta object


I'm using AngularFire 7.4.1 with Angular 14.2.4 and RxFire 6.0.3

Since I'm updated angular from 12 to 15, AngularFire is throwing the following error:

ERROR FirebaseError: Expected type 'Ea', but it was: a custom Ta object

I'm importing everything from @angular/fire, including methods that are needed for module setup:

import { connectFirestoreEmulator, getFirestore, provideFirestore } from "@angular/fire/firestore";

... 
provideFirestore(() => {
    const firestore = getFirestore();
        if (!environment.production) {
            try {
                connectFirestoreEmulator(firestore, "localhost", 8081);
            } catch (error) {
                console.error(error);
            }
        }

        return firestore;
}),
...

The error is originating from this part of my code:

import { Firestore, doc, docData } from "@angular/fire/firestore";

foo() {
    return docData(doc(this.firestore, "metadata", "something")).pipe(
        map((data) => data?.stringArrayProperty ?? [])
    );
}

Why do I get this error?


Solution

  • Turns out something was stuck among my node_modules, so running rimraf -rf node_modules and same for package-lock.json, then running npm i again solved the issue.