Skip to content
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

Increment no longer working on AWS #592

Closed
NinitoAS opened this issue May 26, 2022 · 7 comments · Fixed by #593 or #580
Closed

Increment no longer working on AWS #592

NinitoAS opened this issue May 26, 2022 · 7 comments · Fixed by #593 or #580
Labels
api: firestore Issues related to the googleapis/python-firestore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@NinitoAS
Copy link

Hi,

It seems like Increment recently stopped working after the newest update on AWS Linux 2.

Environment details

  • OS type and version: Linux 4.14.275-207.503.amzn2.x86_64 #1 SMP Wed Apr 13 20:24:50 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • Python version: 3.8.5
  • pip version: pip 22.0.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
  • google-cloud-firestore version: 2.5.0

Steps to reproduce

  1. Run the code below

Code example

from firebase_admin import credentials, firestore, initialize_app
from google.cloud.firestore_v1 import Increment

cred = credentials.Certificate("test.json")

initialize_app(cred)
db = firestore.client()

db.collection("test").document("test").set({"count": Increment(1)}, merge=True)

Stack trace

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ec2-user/.local/lib/python3.8/site-packages/google/cloud/firestore_v1/document.py", line 166, in set
    batch, kwargs = self._prep_set(document_data, merge, retry, timeout)
  File "/home/ec2-user/.local/lib/python3.8/site-packages/google/cloud/firestore_v1/base_document.py", line 217, in _prep_set
    batch.set(self, document_data, merge=merge)
  File "/home/ec2-user/.local/lib/python3.8/site-packages/google/cloud/firestore_v1/base_batch.py", line 107, in set
    write_pbs = _helpers.pbs_for_set_with_merge(
  File "/home/ec2-user/.local/lib/python3.8/site-packages/google/cloud/firestore_v1/_helpers.py", line 870, in pbs_for_set_with_merge
    set_pb.update_transforms.extend(field_transform_pbs)
TypeError: Expected a message object, but got field_path: "count"
increment {
  integer_value: 1
}

Any suggestions?

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label May 26, 2022
@rburns629
Copy link

I'm having the same issue in GCP Functions. Woke up to similar logs revolving around ArrayUnion and ArrayRemove.

@Mariatta
Copy link
Contributor

Hi @NinitoAS, thanks for reporting the issue and sorry to hear that you're having trouble with this.
I can't seem to replicate the your problem. I'm wondering if perhaps other dependency is causing the issue.
Can you do a pip freeze, and let us know the version of the following libraries?

firebase-admin
google-api-core
protobuf
proto-plus

Thank you.

@Mariatta
Copy link
Contributor

@rburns629 would you mind sharing a sample code snippet for replicating this issue? Thanks.

@NinitoAS
Copy link
Author

Hi @NinitoAS, thanks for reporting the issue and sorry to hear that you're having trouble with this. I can't seem to replicate the your problem. I'm wondering if perhaps other dependency is causing the issue. Can you do a pip freeze, and let us know the version of the following libraries?

firebase-admin
google-api-core
protobuf
proto-plus

Thank you.

Hi, yes of course.

firebase-admin==5.2.0
google-api-core==2.8.0
protobuf==4.21.0
proto-plus==1.20.4

Here are my other dependencies:

CacheControl==0.12.11
cachetools==5.1.0
certifi==2021.10.8
charset-normalizer==2.0.12
distlib==0.3.4
filelock==3.6.0
google-api-python-client==2.49.0
google-auth==2.6.6
google-auth-httplib2==0.1.0
google-cloud-core==2.3.0
google-cloud-firestore==2.5.0
google-cloud-storage==2.3.0
google-crc32c==1.3.0
google-resumable-media==2.3.3
googleapis-common-protos==1.56.1
grpcio==1.46.3
grpcio-status==1.46.3
httplib2==0.20.4
idna==3.3
msgpack==1.0.3
pipenv @ file:///tmp/pipenv-2021.11.9-py2.py3-none-any.whl
platformdirs==2.5.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==3.0.9
requests==2.27.1
rsa==4.8
six==1.16.0
uritemplate==4.1.1
urllib3==1.26.9
virtualenv==20.14.1
virtualenv-clone==0.5.7

@NinitoAS
Copy link
Author

I just updated all the packages you mentioned and I can't seem to reproduce the issue any longer.

Here are the new versions

firebase-admin==5.2.0
google-api-core==2.8.1
protobuf==3.20.1
proto-plus==1.20.5

The issue seem to be connected to protobuf, proto-plus requires protobuf<4.0.0dev,>=3.19.0

So it seems like the issue appears when you have protobuf 4.21.0

Seems like we have to pin our dependency versions for AWS for it to not install v4 of protobuf

@Mariatta
Copy link
Contributor

Yes indeed protobuf 4 is not compatible here. I'd recommend setting the limit as follows:
protobuf >= 3.15.0, <4.0.0dev.

@rburns629
Copy link

rburns629 commented May 26, 2022

@Mariatta My issues were resolved as well by including protobuf==3.20.1 and google-api-core==2.8.1 in my requirements.txt. Thanks for the suggestions!

Mariatta added a commit that referenced this issue May 26, 2022
In proto-plus 1.20.5, the protobuf dependency is pinned to <4.0.0dev

Fix #592
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label May 27, 2022
Mariatta added a commit that referenced this issue May 27, 2022
* fix(deps): Require proto-plus >=1.20.5

In proto-plus 1.20.5, the protobuf dependency is pinned to <4.0.0dev

Fix #592
@meredithslota meredithslota added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
5 participants