firebasecordovacordova-androidcordova-plugin-firebasex

firebase, via cordova-plugin-firebasex plugin, firing before deviceReady is triggered


My app was on Cordova@11 and Cordova-Android@11.1 with cordova-plugin-firebasex@16.0.5 and all was working fine. My prod/app store version is running these versions.

I then upgraded my dev environment to Cordova@12, Cordova-Android@13 and the latest cordova-plugin-firebasex@18.0.7, i also upgraded a few other plugins, but not many. Now when I build and launch my app on local device or emulator I see am getting a FirebasePlugin is not defined error BEFORE my the DeviceReady is firing. When clicking on the error in developer console it takes me to this reference: FirebasePlugin._onAuthIdTokenChange() - but no JS line, just a reference to VM3:1 which implies it's being generated by code within code.

To me, this implies an issue with FirebasePlugin as I am not aware of any other plugin that I am using that is trying to directly reference FirebasePlugin as a dependency.

There was a known issue regarding this that was fixed in cordova-plugin-firebasex@17 - and I can still see the fix in the plugin. But as of 18.0.7 it looks like this issue is back. That being said, the developer @dpa99c of the plugin is on top his project (everyone uses it) and no one else is complaining about this issue (since it was fixed back in v17.0). I have posted to the plugin issues but no one is responding there so I am posting here to see if anyone else might be aware of what is causing this.

My other plugins are:

com-sarriaroman-photoviewer 1.3.0 "PhotoViewer"
com.peerio.cordova.plugin.carrier 1.0.1 "Carrier"
cordova-clipboard 1.3.0 "Clipboard"
cordova-custom-config 5.1.1 "cordova-custom-config"
cordova-launch-review 4.1.3 "Launch Review"
cordova-open-native-settings 1.5.6 "Native settings"
cordova-plugin-android-notch 1.0.0 "AndroidNotch"
cordova-plugin-appavailability 0.4.2 "AppAvailability"
cordova-plugin-appinfo 2.1.2 "AppInfo Plugin"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-customurlscheme 5.0.3 "Custom URL scheme"
cordova-plugin-deeplinks 1.1.1 "Cordova Deeplinks Plugin"
cordova-plugin-device 3.0.0 "Device"
cordova-plugin-deviceinformation 2.0.2 "DeviceInformation"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-enable-multidex 0.2.0 "Enable Multidex"
cordova-plugin-file 8.1.3 "File"
cordova-plugin-file-downloader 0.4.0 "Downloader"
cordova-plugin-file-md5 0.3.3 "MD5 Checksum"
cordova-plugin-file-opener2 4.0.0 "File Opener2"
cordova-plugin-file-transfer 2.0.0 "File Transfer"
cordova-plugin-firebasex 18.0.7 "Google Firebase Plugin"
cordova-plugin-geolocation 5.0.0 "Geolocation"
cordova-plugin-inappbrowser 6.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 3.0.0 "Network Information"
cordova-plugin-qrscanner-11 3.0.5 "QRScanner"
cordova-plugin-request-location-accuracy 2.3.0 "Request Location Accuracy"
cordova-plugin-screensize 1.3.1 "screensize"
cordova-plugin-sim 1.3.3 "SIM"
cordova-plugin-splashscreen 6.0.2 "Splashscreen"
cordova-plugin-statusbar 4.0.0 "StatusBar"
cordova-plugin-vibration 3.1.1 "Vibration"
cordova-plugin-zip 3.1.0 "cordova-plugin-zip"
cordova-sms-plugin 1.0.4 "Cordova SMS Plugin"
cordova.plugins.diagnostic 7.2.3 "Diagnostic"

Three things to note:

  1. My app does not reference FirebasePlugin._onAuthIdTokenChange() anywhere in my base code, so it's definitely coming from within plugin.
  2. The error fires only about 50% of the time I launch the app.
  3. After the error does fire, later on in my environment FirebasePlugin is directly referenced and the plugin seems to be working. So the error doesn't seem to be impacting anything. But that doesn't mean Android Playstore is going to accept a new app submission if this error is triggering when I need to push a new version (which I do soon).

Solution

  • For anyone who discovers a similar issue using cordova-plugin-firebasex v18.0.7 on cordova-android, this is the manual fix for the issue. Hopefully this fix gets merged soon in a new version of firebasex and we won't have to do it manually in the future.

    https://github.com/dpa99c/cordova-plugin-firebasex/pull/941