firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

GeoPoint undefined in 11.0.1

Open wengweng opened this issue 3 years ago • 2 comments

var admin = require("firebase-admin");

new admin.firestore.GeoPoint(latitude, longitude); // Gives error -> TypeError: GeoPoint is not a constructor

The value of admin.firestore.GeoPoint is undefined

I've reverted back to version 10.3.0 and the code works again.

wengweng avatar Sep 21 '22 13:09 wengweng

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Sep 21 '22 13:09 google-oss-bot

This seems similar to #1827 Could you try importing the class using the modular API? More examples are on: https://github.com/firebase/firebase-admin-node/issues/1827#issuecomment-1208475992

import { getFirestore, GeoPoint } from 'firebase-admin/firestore';

lahirumaramba avatar Sep 21 '22 19:09 lahirumaramba

I am having an issue using the geopoint constructor.

const GeoPoint = admin.firestore.GeoPoint;

....

const geopoint = new GeoPoint(latitude, longitude);
// Add 'g' entry to data
data['g'] = {
  geopoint: geopoint,
  'geohash': computedGeohash
};

alexjordi avatar Jul 12 '23 19:07 alexjordi