The emulator logs show no connection attempts or other issues from the broken client versions.
Traceback (most recent call last):
File "C:\source\gcf\venv\lib\site-packages\google\api_core\grpc_helpers.py", line 67, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:\source\gcf\venv\lib\site-packages\grpc\_channel.py", line 946, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:\source\gcf\venv\lib\site-packages\grpc\_channel.py", line 849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
debug_error_string = "{"created":"@1621761335.758000000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3009,"referenced_errors":[{"created":"@1621761320.831000000","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":398,"grpc_status":14}]}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\source\gcf\venv\lib\site-packages\google\api_core\retry.py", line 188, in retry_target
return target()
File "C:\source\gcf\venv\lib\site-packages\google\api_core\grpc_helpers.py", line 69, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.ServiceUnavailable: 503 failed to connect to all addresses
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\source\gcf\main.py", line 25, in <module>
doc_ref.set({
File "C:\source\gcf\venv\lib\site-packages\google\cloud\firestore_v1\document.py", line 167, in set
write_results = batch.commit(**kwargs)
File "C:\source\gcf\venv\lib\site-packages\google\cloud\firestore_v1\batch.py", line 57, in commit
commit_response = self._client._firestore_api.commit(
File "C:\source\gcf\venv\lib\site-packages\google\cloud\firestore_v1\services\firestore\client.py", line 836, in commit
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
File "C:\source\gcf\venv\lib\site-packages\google\api_core\gapic_v1\method.py", line 145, in __call__
return wrapped_func(*args, **kwargs)
File "C:\source\gcf\venv\lib\site-packages\google\api_core\retry.py", line 285, in retry_wrapped_func
return retry_target(
File "C:\source\gcf\venv\lib\site-packages\google\api_core\retry.py", line 203, in retry_target
six.raise_from(
File "<string>", line 3, in raise_from
google.api_core.exceptions.RetryError: Deadline of 60.0s exceeded while calling functools.partial(<function _wrap_unary_errors.<locals>.error_remapped_callable at 0x000001DFD2A20430>, database: "projects/firestore-test/databases/(default)"
writes {
update {
name: "projects/firestore-test/databases/(default)/documents/users/alovelace"
fields {
key: "born"
value {
integer_value: 1815
}
}
fields {
key: "first"
value {
string_value: "Ada"
}
}
fields {
key: "last"
value {
string_value: "Lovelace"
}
}
}
}
, metadata=[('google-cloud-resource-prefix', 'projects/firestore-test/databases/(default)'), ('authorization', 'Bearer owner'), ('x-goog-request-params', 'database=projects/firestore-test/databases/%28default%29'), ('x-goog-api-client', 'gl-python/3.9.1 grpc/1.38.0 gax/1.28.0 gapic/2.1.1')]), last exception: 503 failed to connect to all addresses
Environment details
google-cloud-firestoreversion: 2.1.0 - 2.1.1 at least are affectedSteps to reproduce
pip install google-cloud-firestorein e.g. a virtualenvgcloud beta emulators firestore start --host-port=127.0.0.1:8686FIRESTORE_EMULATOR_HOST=127.0.0.1:8686environment variablefailed to connect to all addresseson first database accessCrashes near instantly if you use the
asyncclient but synchronous client gets it after some lengthy timeout.If you run this exact same code but
pip install google-cloud-firestore==1.9.0, it works perfectly.==2.0.0crashes becauseGOOGLE_APPLICATION_CREDENTIALSis not set?2.0.1works,2.0.2works.I tried the myriad of other
FIREBASE_FIRESTORE_EMULATOR_ADDRESSetc. and none of them seemed to resolve anything, and the documentation nor the code does not seem to support that this should be necessary. I also tried running the emulator viafirebase emulators:start --only firestorebut that seemed to be just a downgrade without solving any problems - it didn't allow me to set the port without some configuration file.The emulator logs show no connection attempts or other issues from the broken client versions.
Code example
Your own example code modified just to work with an emulator in general:
Stack trace
From
==2.1.1