Reputation: 906
I have a fastAPI api hosted on appengine. it makes calls to firestore using firestore client. Sometimes, some (1 out of 50) of the calls fail with this error:
NB: I use latest version of grpcio, grpcio-tools and google-cloud-firestore.
AttributeError: 'NoneType' object has no attribute 'from_call'
at ._parse_grpc_error_details ( /layers/google.python.pip/pip/lib/python3.7/site-packages/google/api_core/exceptions.py:553 )
at .from_grpc_error ( /layers/google.python.pip/pip/lib/python3.7/site-packages/google/api_core/exceptions.py:605 )
at .error_remapped_callable ( /layers/google.python.pip/pip/lib/python3.7/site-packages/google/api_core/grpc_helpers.py:144 )
at .retry_target ( /layers/google.python.pip/pip/lib/python3.7/site-packages/google/api_core/retry.py:190 )
at .retry_wrapped_func ( /layers/google.python.pip/pip/lib/python3.7/site-packages/google/api_core/retry.py:288 )
at .__call__ ( /layers/google.python.pip/pip/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py:154 )
at .batch_get_documents ( /layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/services/firestore/client.py:870 )
at .get ( /layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/document.py:406 )
Upvotes: 2
Views: 532
Reputation: 360
This error is caused by a missing import of the grpcio-status
module. Unfortunately, that module is lazily loaded, and in older versions of the grpc client libraries, that missing module would result in every single grpc error being masked with an exception like the one you received. In newer versions, they do checks for this failed import and will emit python warnings about needing the status module installed.
You can see this issue: https://github.com/googleapis/python-api-core/issues/659
and this PR: https://github.com/googleapis/python-api-core/pull/680
and then question your life choices.
Upvotes: 0
Reputation: 1640
"AttributeError: 'NoneType' object has no attribute 'from_calll’”
Is a python error when you are trying to invoke a method in this case from_call over a None object.
An AttributeError is raised in Python when you attempt to call the attribute of an object whose type does not support the method.
There are different reasons which can cause “AttributeError: 'NoneType' object has no attribute 'something'” in this document.
You can check with the documentation and Stackoverflow link for more insights on the issue.
I’m not sure which version of cloud firestore you are using but have a look on the cloud firestore version and the latest version is 2.6.1 which is compatible with python 3.7 onwards
Upvotes: -2