I am using Firebase's CloudFirestore feature for updating the entries in my database. When I run the code it works fine for around 10 seconds, then it crashes with the following error:
File "C:\Users\mypc\AppData\Local\Programs\Python\Python35-32\lib\site-packages\google\api_core\grpc_helpers.py", line 78, in next
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.DeadlineExceeded: 504 Deadline Exceeded
Here is my implementation that causes the issue:
existing = db.collection(u'pages').where(u'season', u'==', u'summer').get()
for x in existing:
obj = x.to_dict()
doc_ref = db.collection(u'pages').document(u'%s' % (obj['uid'],))
doc_ref.update({u'year': "2019"})
As you can see it's a quite simple function and I have no idea why it crashes if it's working for the first 10 seconds. I am on a paid plan so exceeding the limit can't be the problem. My idea is that I am doing something very wrong and my code causes the error, or it's simply a bug.