question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 6 - Error while creating an instance of GeoFire

See original GitHub issue

Version 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:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:33 (12 by maintainers)

github_iconTop GitHub Comments

7reactions
MichaelSolaticommented, Aug 3, 2018

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 with npm i firebase/geofire-js.

6reactions
jQrgencommented, Apr 26, 2019

This works in firebase functions with node 8:

// Import
const geofire = require('geofire');

// Usage
const geoFireInstance = new geofire.GeoFire(ref);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 6 GeoFire Initialization GeoFire is not a constructor
The codebase for geofire has been updated to resolve this issue however a new build has not been deployed to npm. You could...
Read more >
angular geofire query - Google Groups
In my singlepage app (angular) I have a model bound to this Firebase ref and an iteration through these items (i.e. ng-repeat "r...
Read more >
Location-based Queries with GeoFire and Angular Google Maps
In this episode, I will show you how to query Firebase data based on its proximity to a set of GPS coordinates. We...
Read more >
[Solved]-Fetching users and Geofire query keys take long time ...
Coding example for the question Fetching users and Geofire query keys take long time with Firebase-rx.js.
Read more >
GeoFire — Realtime location queries with Firebase - npm
Latest version: 6.0.0, last published: 4 months ago. ... Creates and returns a new GeoFire instance to manage your location data.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found