Skip to content

Error when calling QueryDocumentSnapshot.data() for GeoPoint 0, 0 #337

@mortillan

Description

@mortillan

[READ] Step 1: Are you in the right place?

  • For issues or feature requests related to the code in this repository
    file a Github issue.
    • If this is a feature request make sure the issue title starts with "FR:".
  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Operating System version: Ubuntu 16.04 x64
  • Firebase SDK version: 5.13??
  • Library version: 5.13??
  • Firebase Product: firestore

[REQUIRED] Step 3: Describe the problem

Receiving error from Firebase Functions

Error: Argument "latitude" is not a valid number.
at Object.exports.(anonymous function) [as isNumber] (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/build/src/validate.js:89:23)
at new GeoPoint (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/build/src/document.js:84:18)
at Function.fromProto (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/build/src/document.js:143:16)
at QueryDocumentSnapshot._decodeValue (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/build/src/document.js:518:33)
at QueryDocumentSnapshot.data (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/build/src/document.js:401:34)
at QueryDocumentSnapshot.data (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/build/src/document.js:782:26)
at exports.handle (/user_code/lib/triggers/SosNotification.js:7:21)

Steps to reproduce:

What happened? How can we make the problem occur?
This could be a description, log/console output, etc.

I'm not sure if my assumptions are correct, but the error I am encountering comes from calling QueryDocumentSnapshot.data() for a document reference w/c has a GeoPoint(0, 0) value. I have confirmed that @google-cloud/firestore library allows creating this kind of GeoPoint

image

Relevant Code:

Just create a document with a field location: new admin.firestore.GeoPoint(0,0).

then fetch that document. you will get this error when you call snapshot.data() function in the then() function

// TODO(you): code here to reproduce the problem

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions