Closed whaatt closed 4 years ago
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Try importing GeoPoint
from firebase-admin
.
const someModel = {
location: new admin.firestore.GeoPoint(0, 0)
}
@hiranya911 Yeah, mentioned in the OP that this workaround fixes the issue. But unfortunately for pre-existing codebases where the two imports are mixed, this new error is a regression.
In general types of these two libraries won't mix. That's why firebase-admin
re-exports Firestore types in its own admin.firestore
namespace. We've seen similar issues with other types in the past. If GeoPoint happened to work in the old versions, that's not by design.
We have update Firebase Admin to include @google-cloud/firestore
at version 3. While we don't recommend or officially support mixing of types between admin.firestore
and firestore
, the usage pattern described in this issue should be possible again.
Versions:
Steps to reproduce:
My library has
@google-cloud/firestore@3.1.0
andfirebase-admin@8.9.0
installed (so this is the latest version that has upgraded to Firestore 3). Consider the following snippet:When running this snippet, I get an error with the following stack trace:
If I replace the
GeoPoint
import withadmin.firestore.GeoPoint
(i.e. theGeoPoint
class packaged withfirebase-admin
), this snippet works fine.This appears to be a regression between the latest versions of the two libraries (
firebase-admin@8.8.0
and@google-cloud/firestore@2.6.1
don't have this conflict).I would consider using only
firebase-admin
instances of the Firestore types (if this is now necessary), but I would like to have confidence that there isn't a deeper issue.Thanks in advance!