angularfirebase-realtime-databaseionic5geofire

Firebase geoFire set error - Cannot read properties of undefined (reading 'pieceNum_')


I am updating an old Ionic Angular app and I upgraded my firebase module to 9.23.0 and the geofire module to 6.0.0. In doing so when I call the set function on geoFire, with an id and an array of coordinates, I get the error below. This was working fine with earlier version of geoFire.

I can't find much information on how to resolve this except this stackoverflow link that suggests rolling back the firebase and geofire modules. I can't do rollback because of some other errors.

error =  TypeError: Cannot read properties of undefined (reading 'pieceNum_')
    at qt (geofire.min.js:590:980)
    at geofire.min.js:1299:1686
    at rt (geofire.min.js:361:2620)
    at Qr (geofire.min.js:1299:1645)
    at As (geofire.min.js:1397:3182)
    at e.set (geofire.min.js:1430:9558)

My ionic info output is as below

Ionic:

   Ionic CLI                     : 7.1.1 (/Users/username/.nvm/versions/node/v20.2.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.9.4
   @angular-devkit/build-angular : 13.3.11
   @angular-devkit/schematics    : 13.3.11
   @angular/cli                  : 13.3.11
   @ionic/angular-toolkit        : 6.1.0

Capacitor:

   Capacitor CLI      : 5.5.1
   @capacitor/android : 5.5.1
   @capacitor/core    : 5.5.1
   @capacitor/ios     : 5.5.1

Cordova:

   Cordova CLI       : 12.0.0 (cordova-lib@12.0.1)
   Cordova Platforms : android 9.1.0, browser 6.0.0, ios 6.2.0
   Cordova Plugins   : cordova-plugin-ionic-webview 4.2.1, (and 3 other plugins)

Utility:

   cordova-res                          : 0.15.4
   native-run (update available: 2.0.0) : 1.7.4

System:

   ios-sim : 8.0.2
   NodeJS  : v20.2.0 (/Users/username/.nvm/versions/node/v20.2.0/bin/node)
   npm     : 9.6.6
   OS      : macOS Unknown
   Xcode   : Xcode 15.0.1 Build version 15A507

Thank you for any guidance on how to address this issue.


Solution

  • Downgrading to geofire : ^5.2.0 helped me get out of this pickle.
    Credits to suggestions found on the geofire github issue page: https://github.com/firebase/geofire-js/issues/258