@firebase/firestore: Firestore (6.0.4): INTERNAL UNHANDLED ERROR: configureNetworkMonitoring


  • Operating System version: Ubuntu 18.04
  • Browser version: Not relevant
  • Firebase SDK version: v6.0.4
  • Firebase Product: Firestore (database)
  • Expo version: v32.0.6

Problem description:

I’m developing a app with React Native and Expo and it has been in development since earlier this year. I started intergrating Firebase Firestore and Auth in my app right away with this package and I even have a production build in Testflight, meaning that Firebase works perfectly. I never had a problem with Firebase before.

Yesterday I changed some configuration in my app, such as the display name, some email templates and I’ve added a custom email domain to send emails from. I also upgraded some packages of my application, including Firebase. I’ve upgraded these versions:

  • firebase from “v5.11.1” to “v6.0.4”.
  • react-navigation from “v3.9.1” to “v3.11.0”. (Probably not relevant)

After all these changes I was still able to register and login my app, but as of today my Firestore is crashing all the time. I would like to make it clear that my firebase authentication works fine.

This is the error I’m getting, it may be different sometimes but it is always the Firestore:

Steps to reproduce:

I would love to provide the steps needed to reproduce this problem, but this seems like a strange bug to me so I’m really not sure if/how you can reproduce this issue.

Relevant Code:

Please let me know what code you would like to see. I’m not sure what to post because my application always worked and I did not change any code.

More information:

You can find a post about this on Reddit which I have made here.

7 thoughts on “@firebase/firestore: Firestore (6.0.4): INTERNAL UNHANDLED ERROR: configureNetworkMonitoring

  1. Same problem here with Expo SDK 32.
    I tried to upgrade to 6.04 and downgrade to 5.11.1, to clean every piece of cache, to create a new project and copy the files… Nothing worked.
    I initially did not change any code, this just started malfunctionning by its own.

  2. @QuintonC Thanks, but it did not help.

    As a workaround, I set “window” object to “undefined” before calling firestore until this bug fixed, sounds bad but it seems working now.
    At least I can continue to develop for today.

    componentDidMount() { window = undefined; let db = firebase.firestore(); ...

  3. For me the issue occurred once I updated to the newest expo client app today.
    Expo released Expo Web with version 33 the other day. I haven’t taken a closer look but I believe they needed to introduce some kind of window object which sounds closely related with what @mikelehen said. Nice input btw 🙂

    I checked and window is defined in my app. Going to unset it for now.
    Anyone planing to use expo-web in near future? Since window seems to be not fully functional I guess the issue rather is on expo’s instead of firebase’ side

    Two options for near future I guess:
    a) Expo only sets window for web environment
    b) We take care of it ourselves with something like:

    import {Platform} from 'react-native'
    // expo-web is inspired or based on react-native-web 
    // which introduces a 'web' as platform value
    if (Platform.OS !== 'web') {
      window = undefined
  4. @mikelehen Thanks for your help. Full error message on my machine:

    @firebase/firestore:, Firestore (6.1.1): INTERNAL UNHANDLED ERROR: , configureNetworkMonitoring
    [Unhandled promise rejection: TypeError: window.addEventListener is not a function. (In 'window.addEventListener('online', this.networkAvailableListener)', 'window.addEventListener' is undefined)]
    - node_modules/@firebase/firestore/dist/index.cjs.js:6993:32 in configureNetworkMonitoring
    - node_modules/@firebase/firestore/dist/index.cjs.js:6983:8 in BrowserConnectivityMonitor
    - node_modules/@firebase/firestore/dist/index.cjs.js:7414:19 in newConnectivityMonitor
    - node_modules/@firebase/firestore/dist/index.cjs.js:19046:46 in <unknown>
    - node_modules/tslib/tslib.js:133:31 in step
    - node_modules/tslib/tslib.js:114:61 in <unknown>
    - node_modules/tslib/tslib.js:107:17 in <unknown>
    - node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
    - node_modules/promise/setimmediate/core.js:200:23 in doResolve
    - node_modules/promise/setimmediate/core.js:66:12 in Promise
    - node_modules/tslib/tslib.js:103:40 in __awaiter
    - node_modules/promise/setimmediate/core.js:37:14 in tryCallOne
    - node_modules/promise/setimmediate/core.js:123:25 in <unknown>
    - node_modules/react-native/Libraries/Core/Timers/JSTimers.js:152:14 in _callTimer
    - node_modules/react-native/Libraries/Core/Timers/JSTimers.js:200:17 in _callImmediatesPass
    - node_modules/react-native/Libraries/Core/Timers/JSTimers.js:464:30 in callImmediates
    * [native code]:null in callImmediates
    - node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:320:6 in 
    - node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 in <unknown>
    - node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:297:10 in __guard
    - node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:17 in flushedQueue
    * [native code]:null in flushedQueue
    * [native code]:null in invokeCallbackAndReturnFlushedQueue

    @yannickschuchmann Your solution helps to make firestore working but unfortunately causes an error within Expo app on iOS as it tries to create a new instance of window.WebSocket (which is undefined then) in method connectToDevTools. Do you have the same problem?