Angular 6 - Error while creating an instance of GeoFire
See original GitHub issueVersion info
Firebase: ^4.12.1 GeoFire: ^4.1.2
Other (e.g. Node, browser, operating system) (if applicable): “agm/core”: “^1.0.0-beta.2”, “angular/animations”: “^6.0.0”, “angular/cdk”: “^6.0.0”, “angular/common”: “^6.0.0”, “angular/compiler”: “^6.0.0”, “angular/core”: “^6.0.0”, “angular/forms”: “^6.0.0”, “angular/http”: “^6.0.0”, “angular/material”: “^6.0.0”, “angular/platform-browser”: “^6.0.0”, “angular/platform-browser-dynamic”: “^6.0.0”, “angular/router”: “^6.0.0”, “fortawesome/fontawesome”: “^1.1.7”, “ng-select/ng-select”: “^1.4.0”, “ngrx/effects”: “^5.2.0”, “ngrx/store”: “^5.2.0”, “angularfire2”: “^5.0.0-rc.6.0”, “bootstrap”: “^4.1.0”, “cordova-android”: “^7.1.0”, “cordova-plugin-device”: “^2.0.2”, “cordova-plugin-geolocation”: “~4.0.1”, “core-js”: “^2.5.5”, “firebase”: “^4.12.1”, “font-awesome”: “^4.7.0”, “geofire”: “^4.1.2”, “hammerjs”: “^2.0.8”, “mt-latlon”: “^0.1.1”, “rxjs”: “>=5.6.0-forward-compat.4”, “rxjs-compat”: “^6.1.0”, “uuid”: “^3.2.1”, “web-animations-js”: “^2.3.1”, “zone.js”: “0.8.26”
Test case
Steps to reproduce
import { Injectable, NgZone } from ‘@angular/core’; import { AngularFireDatabase } from ‘angularfire2/database’; import { GoogleMapsAPIWrapper } from ‘@agm/core’; import { MapsAPILoader } from ‘@agm/core’; import * as GeoFire from ‘geofire’;
@Injectable() export class GeoService extends GoogleMapsAPIWrapper { dbRef: any; geoFire: any;
constructor(private db: AngularFireDatabase, private auth: AuthService) { const path = this.getDBRef(this.vehicleType); this.dbRef = this.db.list(path); this.geoFire = new GeoFire(this.dbRef.$ref); }
getDBRef = (type) => {
const country = (this.auth.userInfo.country ? this.auth.userInfo.country : ‘India’);
const returnDBRef = ${country}/${type.toLowerCase()}
;
return returnDBRef;
};
}
Expected behavior
The geoFire instance should be created
Actual behavior
Runtime error while creating the following: this.geoFire = new GeoFire(this.dbRef.$ref);
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:33 (12 by maintainers)
Top GitHub Comments
The codebase for
geofire
has been updated to resolve this issue however a new build has not been deployed to npm. You could install straight from GitHub though withnpm i firebase/geofire-js
.This works in firebase functions with node 8: