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

Firebase Queries - “cannot read property of null” after upgrade to NS 3.4.0 #585

Closed
kmuthukrishnan opened this issue Dec 24, 2017 · 2 comments
Milestone

Comments

@kmuthukrishnan
Copy link

Hi @EddyVerbruggen ,

I am using the nativescript firebase plugin exetnsively in my project (Thanks!)

The project works perfectly well in Nativescript 3.3. I upgraded my project to Nativescript 3.4. After upgrading the project, I am facing a major issue with all firebase queries.

**JS: Error in firebase.query: TypeError: Cannot read property 'child' of null**
JS: NO QUESTIONS FOR THIS USER
JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'length' of undefined
JS: TypeError: Cannot read property 'length' of undefined
JS:     at file:///data/data/org.nativescript.qbank/files/app/feed/alphaCreate.component.js:55:23
JS:     at SafeSubscriber.schedulerFn [as _next] (file:///data/data/org.nativescript.qbank/files/app/tns_modules/@angular/core/bundles/core.umd.js:3870:36)
JS:     at SafeSubscriber.__tryOrUnsub (file:///data/data/org.nativescript.qbank/files/app/tns_modules/rxjs/Subscriber.js:238:16)
JS:     at SafeSubscriber.next (file:///data/data/org.nativescript.qbank/files/app/tns_modules/rxjs/Subscriber.js:185:22)
JS:     at Subscriber._next (file:///data/data/org.nativescript.qbank/files/app/tns_modules/rxjs/Subscriber.js:125:26)
JS:     at Subscriber.next (file:///data/data/org.nativescript.qbank/files/app/tns_modules/rxjs/Subscriber.js:89:18)
JS:     at EventEmitter.Subject.next (file:///data/data/org.nativescript.qbank/files/app/tns_modules/rxjs/Subject.js:55:25)
JS:     at EventEmitter.emit (file:///data/data/org.nativescript.qbank/files/app/tns_modules/@angular/core/bundles/core.umd.js:3844:76)
JS:     at file:///data/data/org.nativescript.qbank/files/app/services/my-questions.service.js:51:42
JS:     at ZoneDelegate.invoke (file:///data/data/org.nativescript.qbank/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:365:26)
JS:     at Object.onInvoke (file:///data/data/org.nativescript.qbank/files/app/tns_modules/@angular/core/bundles/core.umd.js:4156:37)
JS:     at ZoneDelegate.invoke (file:///data/data/org.nativescript.qbank/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:364:32)
JS:     at Zone.run (file:///data/data/org.nativescript.qbank/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:125:43)
JS:     at file:///data/data/org.nativescript.qbank/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:760:57
JS:     at ZoneDelegate.invokeTask (file:///data/data/org.nativescript.qbank/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:398:31)

I tried to resolve it by
a. upgrading the native script firebase plugin: 5.0.5
b. upgrading all the dependenices of the project

But the issue is still occurring. This is a big blocker, and Please suggest what I can do to fix this.

My package json is as below:

{
  "android": {
    "markingMode": "none"
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.qbank",
    "tns-ios": {
      "version": "3.4.0"
    },
    "tns-android": {
      "version": "3.4.0"
    }
  },
  "dependencies": {
    "@angular/animations": "~5.0.0",
    "@angular/common": "~5.0.0",
    "@angular/compiler": "~5.0.0",
    "@angular/core": "~5.0.0",
    "@angular/forms": "~5.0.0",
    "@angular/http": "~5.0.0",
    "@angular/platform-browser": "~5.0.0",
    "@angular/platform-browser-dynamic": "~5.0.0",
    "@angular/router": "~5.0.0",
    "nativescript-algolia": "0.0.4",
    "nativescript-angular": "~5.0.0",
    "nativescript-camera": "^3.1.4",
    "nativescript-email": "^1.5.1",
    "nativescript-fancyalert": "^1.1.2",
    "nativescript-filter-select": "^1.2.1",
    "nativescript-geolocation": "^3.0.0",
    "nativescript-gif": "^1.0.9",
    "nativescript-imagepicker": "^4.0.1",
    "nativescript-iqkeyboardmanager": "^1.1.0",
    "nativescript-loading-indicator": "^2.3.2",
    "nativescript-plugin-firebase": "^5.0.5",
    "nativescript-pro-ui": "^3.3.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-toast": "^1.4.5",
    "nativescript-web-image-cache": "^4.2.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "^5.5.0",
    "tns-core-modules": "^3.4.0"
  },
  "devDependencies": {
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "codelyzer": "~4.0.2",
    "es6-promise-loader": "^1.0.2",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "^0.6.0",
    "tslint": "^5.1.0",
    "typescript": "~2.4.2",
    "zone.js": "^0.8.4"
  }
}

@kmuthukrishnan
Copy link
Author

kmuthukrishnan commented Jan 3, 2018

I solved the issue.
The problem was that Firebase was not initialising. I solved this by putting firebase init in a timeout.

@EddyVerbruggen
Copy link
Owner

See #613.

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

2 participants