-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Cannot encode [object Object]to a Firestore Value. Local testing does not yet support Firestore geo points. #47
Comments
Any updates on this ? This is a pretty important feature |
"Error: Cannot encode [object Object]to a Firestore Value. Local testing does not yet support Firestore geo points" Same error, but I don't use firestore.GeoPoint in my snapshot. The issue - and the solution - may be bigger than only using GeoPoints in the tested collection. UPDATE: this message only occurs when testing any "onWrite" firestore trigger function. Maybe the failure comes from the different setup for onWrite: onWrite setup (source):
onCreate setup: Both setups run this: |
Any updates on this? I don't use GeoPoints at all and this is failing as @vladimirbrasil describes |
This also affects (I think all) of the WORKAROUND |
Fyi to anyone tripping over this. This can happen when you are trying to write invalid types to firestore fields. The error message is just poorly written. It doesn't necessarily have anything to do with geo points. |
Has this in any way been solved? I have the exact issue with trying to mock .onUpdate with documents containing GeoPoints. I can get the .makeDocumentSnapshot() to pass if I pass in an object with {latitude,longitude} but in the function I'm specifically using the isEqual() of the GeoPoint to make comparisons. Resulting in the test failing cause isEqual isn't defined on my mock. Its kind of an important feature of a testing library to be able to test the convoluted classes that they make for us 😅 |
I hit this error too and my document does not have geo points. Even a document reference and timestamp cause this. |
Version info
firebase-functions-test: 0.1.6
firebase-functions: 3.2.0
firebase-admin: NOT REQUIRED
@firebase/testing: 0.13.3
Test case
Steps to reproduce
Execute test case provided, error is thrown during the call to
test.firestore.makeDocumentSnapshot
.Expected behavior
Snapshot created successfully, function is execution is emulated as is trigger has occurred.
Actual behavior
Call to
test.firestore.makeDocumentSnapshot
fails due to GeoPoint in the data model.Produces error:
The text was updated successfully, but these errors were encountered: