Closed akashrajkn closed 5 months ago
exact same problem, nothing on internet helps. seems only few people like you and me getting this. I tried chatgpt, it also pointed to this error. I first could not believe it, until I ran the exact code on the firebase official help doc, and it get the same error...... I just waste 2hour on bug from Google... maybe i should use dynamodb
Same also have this error and sometimes bumping the version of the library helps. But I'm already at latest now...
Now i am facing firestore.Increment function does nothing to the actual data field, and no error at all. I expect better from Google.
@hansheng654 Based on this comment, I changed urllib3 package version to 1.26.15
. After this, I don't get the above issue. Maybe this helps you?
Hi @akashrajkn, thanks for filing this and providing an example. I tried this out with the latest version of the library (2.15.0) and was unable to reproduce this. Here's what I did:
document = db.collection("my-collection").document("number_doc")
f = float(1)
document.update({'num': firestore.Increment(f)})
I also tried different numbers, like 1.222
and was able to see the update successfully. Please let me know if you are still experiencing this issue after upgrading to the latest version. Thanks!
@kolea2 Thanks for the reply! With version 2.15.0
, I don't get the issue. Feel free to close this issue.
Awesome, thanks for confirming!
Getting this same message, version 2.17.0, trying to execute this line:
db.collection("users").document(user_id).set(user_record)
Writing to the emulator, not the actual cloud. Recently did a pip install -r requirements.txt and it seemed to break this, worked before. Unfortunately I don't have that log so can't say exactly what upgraded. Deprecating urllib3 to 1.26.15 was no help
message:
mailer_test.py:50: in create_test_data
db.collection("users").document(user_id).set(user_record)
/usr/local/anaconda3/lib/python3.12/site-packages/google/cloud/firestore_v1/document.py:165: in set
batch, kwargs = self._prep_set(document_data, merge, retry, timeout)
/usr/local/anaconda3/lib/python3.12/site-packages/google/cloud/firestore_v1/base_document.py:214: in _prep_set
batch.set(self, document_data, merge=merge)
/usr/local/anaconda3/lib/python3.12/site-packages/google/cloud/firestore_v1/base_batch.py:112: in set
write_pbs = _helpers.pbs_for_set_no_merge(
...
if extractor.has_transforms:
field_transform_pbs = extractor.get_field_transform_pbs(document_path)
> set_pb.update_transforms.extend(field_transform_pbs)
E TypeError: Not a cmessage
/usr/local/anaconda3/lib/python3.12/site-packages/google/cloud/firestore_v1/_helpers.py:723: TypeError
Environment details
Ubuntu 22.04
3.10.13
23.2.1
google-cloud-firestore
version:2.11.0
Steps to reproduce
Run below code.
duration
is a float.total_duration
field's type is NumberRelevant package versions
Code example
Stack trace