google-cloud-python: FireStore GaxError: Request Entity Too Large

Not clear if this is a bug or not, but the error message seemed pretty strange. The code below threw the following error messsage:

import json
from google.cloud import firestore

db = firestore.Client.from_service_account_json('serviceAccountCredentials.json')
data = json.load(open('/home/alexander/Downloads/cresicor-dev-export.json'))

companies = data['companies']

# update companies
for cid, company in companies.items():
    company_ref = db.collection('companies').document(cid)
    company_ref.set(company)

Error Message:

---------------------------------------------------------------------------
_Rendezvous                               Traceback (most recent call last)
/home/alexander/anaconda3/lib/python3.5/site-packages/google/gax/api_callable.py in inner(*args, **kwargs)
    375         try:
--> 376             return a_func(*args, **kwargs)
    377         # pylint: disable=catching-non-exception

/home/alexander/anaconda3/lib/python3.5/site-packages/google/gax/retry.py in inner(*args)
     67         updated_args = args + (timeout,)
---> 68         return a_func(*updated_args, **kwargs)
     69 

/home/alexander/anaconda3/lib/python3.5/site-packages/grpc/_channel.py in __call__(self, request, timeout, metadata, credentials)
    506                                                credentials)
--> 507         return _end_unary_response_blocking(state, call, False, deadline)
    508 

/home/alexander/anaconda3/lib/python3.5/site-packages/grpc/_channel.py in _end_unary_response_blocking(state, call, with_call, deadline)
    454     else:
--> 455         raise _Rendezvous(state, None, None, deadline)
    456 

_Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNAVAILABLE, 413:Request Entity Too Large)>

During handling of the above exception, another exception occurred:

GaxError                                  Traceback (most recent call last)
<ipython-input-8-b018dddf4a82> in <module>()
     12 for cid, company in companies.items():
     13     company_ref = db.collection('companies').document(cid)
---> 14     company_ref.set(company)
     15 
     16 # update users

/home/alexander/anaconda3/lib/python3.5/site-packages/google/cloud/firestore_v1beta1/document.py in set(self, document_data, option)
    222         batch = self._client.batch()
    223         batch.set(self, document_data, option=option)
--> 224         write_results = batch.commit()
    225         return _first_write_result(write_results)
    226 

/home/alexander/anaconda3/lib/python3.5/site-packages/google/cloud/firestore_v1beta1/batch.py in commit(self)
    133             commit_response = self._client._firestore_api.commit(
    134                 self._client._database_string, self._write_pbs,
--> 135                 transaction=None, options=self._client._call_options)
    136 
    137         self._write_pbs = []

/home/alexander/anaconda3/lib/python3.5/site-packages/google/cloud/firestore_v1beta1/gapic/firestore_client.py in commit(self, database, writes, transaction, options)
    849         request = firestore_pb2.CommitRequest(
    850             database=database, writes=writes, transaction=transaction)
--> 851         return self._commit(request, options)
    852 
    853     def rollback(self, database, transaction, options=None):

/home/alexander/anaconda3/lib/python3.5/site-packages/google/gax/api_callable.py in inner(request, options)
    450                 func, this_settings.timeout, **this_settings.kwargs)
    451         api_call = _catch_errors(api_call, gax.config.API_ERRORS)
--> 452         return api_caller(api_call, this_settings, request)
    453 
    454     if settings.page_descriptor:

/home/alexander/anaconda3/lib/python3.5/site-packages/google/gax/api_callable.py in base_caller(api_call, _, *args)
    436     def base_caller(api_call, _, *args):
    437         """Simply call api_call and ignore settings."""
--> 438         return api_call(*args)
    439 
    440     def inner(request, options=None):

/home/alexander/anaconda3/lib/python3.5/site-packages/google/gax/api_callable.py in inner(*args, **kwargs)
    378         except tuple(to_catch) as exception:
    379             utils.raise_with_traceback(
--> 380                 gax.errors.create_error('RPC failed', cause=exception))
    381 
    382     return inner

/home/alexander/anaconda3/lib/python3.5/site-packages/future/utils/__init__.py in raise_with_traceback(exc, traceback)
    417         if traceback == Ellipsis:
    418             _, _, traceback = sys.exc_info()
--> 419         raise exc.with_traceback(traceback)
    420 
    421 else:

/home/alexander/anaconda3/lib/python3.5/site-packages/google/gax/api_callable.py in inner(*args, **kwargs)
    374         """Wraps specified exceptions"""
    375         try:
--> 376             return a_func(*args, **kwargs)
    377         # pylint: disable=catching-non-exception
    378         except tuple(to_catch) as exception:

/home/alexander/anaconda3/lib/python3.5/site-packages/google/gax/retry.py in inner(*args)
     66         """Updates args with the timeout."""
     67         updated_args = args + (timeout,)
---> 68         return a_func(*updated_args, **kwargs)
     69 
     70     return inner

/home/alexander/anaconda3/lib/python3.5/site-packages/grpc/_channel.py in __call__(self, request, timeout, metadata, credentials)
    505         state, call, deadline = self._blocking(request, timeout, metadata,
    506                                                credentials)
--> 507         return _end_unary_response_blocking(state, call, False, deadline)
    508 
    509     def with_call(self, request, timeout=None, metadata=None, credentials=None):

/home/alexander/anaconda3/lib/python3.5/site-packages/grpc/_channel.py in _end_unary_response_blocking(state, call, with_call, deadline)
    453             return state.response
    454     else:
--> 455         raise _Rendezvous(state, None, None, deadline)
    456 
    457 

GaxError: GaxError(RPC failed, caused by <_Rendezvous of RPC that terminated with (StatusCode.UNAVAILABLE, 413:Request Entity Too Large)>)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 26 (10 by maintainers)

Most upvoted comments

That would be fine with me.