Skip to content

FirebaseError: Expected type 'vh', but it was: a function #3641

@ranouf

Description

@ranouf

I have this issue:
FirebaseError: Expected type 'vh', but it was: a function

Do you have any idea why?

Packages:

"@angular/core": "^15.2.10",
"@angular/fire": "^7.6.1",
"firebase": "^11.5.0",

Here is my code:

```

import { Firestore, disableNetwork, enableNetwork } from '@angular/fire/firestore';
import { Inject, Injectable } from '@angular/core';

[...]

 private firestore = Inject(Firestore);

// We should only one enableNetwork() and disableNetwork() call across the app to avoid below issue
// https://github.com/firebase/flutterfire/issues/9986

this.connectionService.monitor().pipe(
  mergeMap(state => {
    if (state?.hasInternetAccess && state?.hasNetworkConnection) {
      return from(enableNetwork(this.firestore)); // Enable network when online
    } else {
      return from(disableNetwork(this.firestore)); // Disable network when offline
    }
  })
).subscribe();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions