Hi all, today I tried to upgrade to a more recent version of google-cloud-bigtable (RowSets, yay!), but I am suddenly running into trouble connecting to the emulator.
I have been using the emulator for our unit tests, and not having to provide real credentials makes everything a lot easier and safer / less expensive.
The last google-cloud-bigtable version where the following code works as intended is 0.29.0.
Also, I used a fresh google/cloud-sdk:slim Docker image with SDK version 221.0.0 and Python 3.5 to rule out any environment weirdness on my system.
$ gcloud beta emulators bigtable start &
[bigtable] Cloud Bigtable emulator running on 127.0.0.1:8086
```python
import os
from google.auth.credentials import AnonymousCredentials
from google.cloud.bigtable import Client
os.environ["BIGTABLE_EMULATOR_HOST"] = 'localhost:8086'
client = Client(project='IGNORE_ENVIRONMENT_PROJECT',
credentials=AnonymousCredentials(),
admin=True)
table = client.instance("fake_instance").table("some_table")
table.create() # No error here, which is good!
Since `0.30.0`, calling the `table_create()` will result in
```python
---------------------------------------------------------------------------
_Rendezvous Traceback (most recent call last)
/usr/local/lib/python3.5/dist-packages/google/api_core/grpc_helpers.py in error_remapped_callable(*args, **kwargs)
58 try:
---> 59 return callable_(*args, **kwargs)
60 except grpc.RpcError as exc:
/usr/local/lib/python3.5/dist-packages/grpc/_channel.py in __call__(self, request, timeout, metadata, credentials)
531 state, call, = self._blocking(request, timeout, metadata, credentials)
--> 532 return _end_unary_response_blocking(state, call, False, None)
533
/usr/local/lib/python3.5/dist-packages/grpc/_channel.py in _end_unary_response_blocking(state, call, with_call, deadline)
465 else:
--> 466 raise _Rendezvous(state, None, None, deadline)
467
_Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.UNAUTHENTICATED
details = "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
debug_error_string = "{"created":"@1540262900.684527593","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1099,"grpc_message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"
>
The above exception was the direct cause of the following exception:
Unauthenticated Traceback (most recent call last)
<ipython-input-7-ab46b898b64a> in <module>()
----> 1 table.create()
/usr/local/lib/python3.5/dist-packages/google/cloud/bigtable/table.py in create(self, initial_split_keys, column_families)
216
217 table_client.create_table(parent=instance_name, table_id=self.table_id,
--> 218 table=table, initial_splits=splits)
219
220 def exists(self):
/usr/local/lib/python3.5/dist-packages/google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client.py in create_table(self, parent, table_id, table, initial_splits, retry, timeout, metadata)
325
326 return self._inner_api_calls['create_table'](
--> 327 request, retry=retry, timeout=timeout, metadata=metadata)
328
329 def create_table_from_snapshot(
/usr/local/lib/python3.5/dist-packages/google/api_core/gapic_v1/method.py in __call__(self, *args, **kwargs)
137 kwargs['metadata'] = metadata
138
--> 139 return wrapped_func(*args, **kwargs)
140
141
/usr/local/lib/python3.5/dist-packages/google/api_core/retry.py in retry_wrapped_func(*args, **kwargs)
258 sleep_generator,
259 self._deadline,
--> 260 on_error=on_error,
261 )
262
/usr/local/lib/python3.5/dist-packages/google/api_core/retry.py in retry_target(target, predicate, sleep_generator, deadline, on_error)
175 for sleep in sleep_generator:
176 try:
--> 177 return target()
178
179 # pylint: disable=broad-except
/usr/local/lib/python3.5/dist-packages/google/api_core/timeout.py in func_with_timeout(*args, **kwargs)
204 """Wrapped function that adds timeout."""
205 kwargs['timeout'] = next(timeouts)
--> 206 return func(*args, **kwargs)
207
208 return func_with_timeout
/usr/local/lib/python3.5/dist-packages/google/api_core/grpc_helpers.py in error_remapped_callable(*args, **kwargs)
59 return callable_(*args, **kwargs)
60 except grpc.RpcError as exc:
---> 61 six.raise_from(exceptions.from_grpc_error(exc), exc)
62
63 return error_remapped_callable
/usr/local/lib/python3.5/dist-packages/six.py in raise_from(value, from_value)
Unauthenticated: 401 Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
With git-bisect I was able to "narrow it down" to commit https://github.com/googleapis/google-cloud-python/commit/86102c959c, so far.
@sduskis @nkemnitz Working on it, should be fixed soon.
Most helpful comment
@sduskis @nkemnitz Working on it, should be fixed soon.