tldr-cloud / tldr-bot

MIT License
8 stars 1 forks source link

Credential issue for local run #21

Closed goswamig closed 4 years ago

goswamig commented 4 years ago

Tried running main.py for various url and always getting 403 error.

Pasting the error below.

extract-summary$ python main.py 
[nltk_data] Downloading package punkt to /Users/gauta/nltk_data...
[nltk_data]   Package punkt is already up-to-date!
/usr/local/lib/python3.7/site-packages/google/auth/_default.py:69: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/grpc/_channel.py", line 826, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/usr/local/lib/python3.7/site-packages/grpc/_channel.py", line 729, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.PERMISSION_DENIED
    details = "Permission 'secretmanager.versions.access' denied for resource 'projects/tldr-278619/secrets/bearer/versions/1' (or it may not exist)."
    debug_error_string = "{"created":"@1593663051.588695000","description":"Error received from peer ipv4:172.217.6.74:443","file":"src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"Permission 'secretmanager.versions.access' denied for resource 'projects/tldr-278619/secrets/bearer/versions/1' (or it may not exist).","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 12, in <module>
    bearer = utils.get_bearer()
  File "/Users/gauta/tldr-bot/functions/extract-summary/utils.py", line 9, in get_bearer
    secret_response = client.access_secret_version(secret_name)
  File "/usr/local/lib/python3.7/site-packages/google/cloud/secretmanager_v1/gapic/secret_manager_service_client.py", line 968, in access_secret_version
    request, retry=retry, timeout=timeout, metadata=metadata
  File "/usr/local/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 143, in __call__
    return wrapped_func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 286, in retry_wrapped_func
    on_error=on_error,
  File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 184, in retry_target
    return target()
  File "/usr/local/lib/python3.7/site-packages/google/api_core/timeout.py", line 214, in func_with_timeout
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
    six.raise_from(exceptions.from_grpc_error(exc), exc)
  File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Permission 'secretmanager.versions.access' denied for resource 'projects/tldr-278619/secrets/bearer/versions/1' (or it may not exist).
b0noI commented 4 years ago

added required permissions to you, please re-open if still see this issues