Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Broken firebase API broken since 8/26 #475

Closed
ishandutta2007 opened this issue Sep 1, 2017 · 10 comments
Closed

Broken firebase API broken since 8/26 #475

ishandutta2007 opened this issue Sep 1, 2017 · 10 comments
Assignees
Milestone

Comments

@ishandutta2007
Copy link

I have been getting this error on my project, so suspecting some change on firebase side I created a fresh new nativescript project, fresh new firebase project with fresh new android app , adding fresh database data, still getting the same error which I have never seen before.
Essentially all firebase.instance inside nativescript-plugin-firebase plugin are null all of a sudden without any change in code from my side.

Error Message Received on terminal:

JS: Error in firebase.addValueEventListener: TypeError: Cannot read property 'child' of null
JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'child' of null
JS: TypeError: Cannot read property 'child' of null
JS:     at file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/nativescript-plugin-firebase/firebase.js:1456:24
JS:     at new ZoneAwarePromise (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:776:29)
JS:     at Object.firebase.addValueEventListener (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/nativescript-plugin-firebase/firebase.js:1444:10)
JS:     at Observable._subscribe (file:///data/data/org.nativescript.bbnsng/files/app/modules/services/firebase.service.js:23:22)
JS:     at Observable._trySubscribe (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/Observable.js:57:25)
JS:     at Observable.subscribe (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/Observable.js:45:27)
JS:     at Observable.ConnectableObservable.connect (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/observable/ConnectableObservable.js:37:18)
JS:     at RefCountOperator.call (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/observable/ConnectableObservable.js:101:49)
JS:     at Observable.subscribe (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/Observable.js:42:22)
JS:     at ObservableStrategy.createSubscription (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/common/bundles/common.umd.js:2664:22)
JS:     at AsyncPipe._subscribe (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/common/bundles/common.umd.js:2778:45)
JS:     at AsyncPipe.transform (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/common/bundles/common.umd.js:2755:22)
JS:     at Object.eval [as updateDirectives] (ng:///HomeModule/HomeComponent.ngfactory.js:127:68)
JS:     at Object.debugUpdateDirectives [as updateDirectives] (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/core/bundles/core.umd.js:12613:21)
JS:     at checkAndUpdateView (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/core/bundles/core.umd.js:12025:14)

Steps followed:

  • Create a new repo
  • Create a new firebase project in firebase console
  • Create an android app under that probject with Package name org.nativescript.bbnsng
  • Run keytool -list -v -keystore ~/.android/bbnsng.keystore to get SHA1, update app with same
  • Add some data to database and make permission rules public
  • Code up the corresponsding nativescript angular app to this state https:/ishandutta2007/bb_ns_ng_main_app2
  • downloaded google-services.json and add it to app/App_Resources/Android/
  • Run the app.

Steps to reproduce:

git clone https:/ishandutta2007/bb_ns_ng_main_app2.git
cd bb_ns_ng_main_app2
tns run android
@EddyVerbruggen
Copy link
Owner

I think firebase.init doesn't run/complete before this runs. Can you verify that by wrapping the latter in a timeout?

@ishandutta2007
Copy link
Author

ishandutta2007 commented Sep 2, 2017

Tried wrapping, still the same.
Actually I am neither seeing the "firebase.init done" nor "firebase.init error: " message in the logs. It's tested and reproduced on multiple developer machines with multiple android devices.
Can it be so that firebase.instance is not geting cached properly?

@prestopasto
Copy link

I'm seeing something similar here. Not getting "firebase.init done" or "firebase.init error". Weird thing is it seems to be Android only. iOS builds are working fine on the same project.

@EddyVerbruggen
Copy link
Owner

I think I know why this happens; this PR introduced a dependency on a very recent tns-core-modules version; it depends on this changeset to be present in your project.

I don't like that dependecy so I'm going to remove the profiling code. Good thing is: Google fixed a few performance issues (mostly related to init) in their latest SDK (which I'm currently upgrading this plugin to).

@ghost
Copy link

ghost commented Sep 9, 2017

Just downloaded the latest version, problem persists for me.

BUILD SUCCESSFUL

Total time: 2 mins 9.582 secs
Project successfully built.
Installing...
Successfully installed on device with identifier 'emulator-5554'.
Successfully transferred all files.
Refreshing application...
Successfully synced application org.nativescript.jw on device emulator-5554.
Executing before-watch hook from /home/asthma/work/nativescript/joinwith/hooks/before-watch/nat
ivescript-dev-typescript.js
Found peer TypeScript 2.5.2
JS: created list view model
JS: Error in firebase.addValueEventListener: TypeError: Cannot read property 'child' of null
JS: ERROR
JS: === dump(): dumping members ===
JS: {}
JS: === dump(): dumping function and properties names ===
JS: === dump(): finished ===
JS: Created a user object

and my package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.jw",
    "tns-ios": {
      "version": "3.1.0"
    },
    "tns-android": {
      "version": "3.1.1"
    }
  },
  "dependencies": {
    "nativescript-fonticon": "^1.1.1",
    "nativescript-geolocation": "^3.0.0",
    "nativescript-imagepicker": "^3.0.2",
    "nativescript-mapbox": "^3.0.1",
    "nativescript-oauth": "^2.0.1",
    "nativescript-plugin-firebase": "^4.1.0",
    "nativescript-telerik-ui": "^3.0.4",
    "nativescript-theme-core": "^1.0.4",
    "tns-core-modules": "^3.1.0",
    "tns-platform-declarations": "^3.1.0"
  },
  "devDependencies": {
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "eslint": "^4.6.1",
    "eslint-config-standard": "^10.2.1",
    "eslint-plugin-promise": "^3.5.0",
    "eslint-plugin-standard": "^3.0.1",
    "lazy": "1.0.11",
    "nativescript-dev-android-snapshot": "^0.*.*",
    "nativescript-dev-typescript": "^0.5.0",
    "typescript": "^2.4.2"
  }
}

@EddyVerbruggen
Copy link
Owner

@ivegotasthma Please try the demo app. If you can reproduce it there then I'll take a look.

@eddysen
Copy link

eddysen commented Sep 9, 2017

Hello having the same issue even after i upgrade the plugin with npm just yesterday. Here is my scenario. I'm trying to merge two projects :
1 - template-tab-navigation-ng
2 - template-drawer-navigation-ng

the second is built on nativescript-plugin-firebase, they both work standalone but as soon as i merge them i'm getting this problem :

JS: Angular is running in the development mode. Call enableProdMode() to enable the production mode.

JS: Error in firebase.addValueEventListener: TypeError: Cannot read property 'child' of null

JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'child' of null

JS: TypeError: Cannot read property 'child' of null


I can add you temporarily to the repository of the project on bitbucket so that you can have a look ...

@EddyVerbruggen
Copy link
Owner

@eddysen If you can reproduce the issue on the demo app then I'll gladly take a look!

@anuragd7
Copy link

Experiencing this issue on Android only since upgrading to tns 3.4.0

@anuragd7
Copy link

Hi @eddysen , @ishandutta2007 , @ivegotasthma, @prestopasto
Did any of you manage to solve this issue. I am getting the same issue after upgrading my app to tns 3.4 and with plugin version 5.0.5
Any pointers will be most helpful. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants