Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback error logs dump when SSO token is expired #402

Open
spencerdcarlson opened this issue Aug 12, 2024 · 0 comments
Open

Traceback error logs dump when SSO token is expired #402

spencerdcarlson opened this issue Aug 12, 2024 · 0 comments

Comments

@spencerdcarlson
Copy link

I don't think is technically qualifies as a bug. Probably more of a feature request, but since the output is asking me to open I ticket I am.

When the SSO token is expired an error log dumps. Maybe improve the messaging for this case?

The relevant output:

Error when retrieving token from sso: Token has expired and refresh failed

You've found a bug! Please, raise an issue attaching the following traceback
https://github.com/jorgebastida/awslogs/issues/new

Version:       0.15.0
Python:        3.12.4 (main, Jun  6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)]
boto3 version: 1.34.128
Platform:      macOS-14.5-arm64-arm-64bit
Args:          ['/opt/homebrew/bin/awslogs', 'get', 'dataverser-cluster-logs', '-s1d', 'ALL', '--profile', '<redacted>']
Config: {options}

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/awslogs/bin.py", line 210, in main
    getattr(logs, options.func)()
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/awslogs/core.py", line 219, in list_logs
    consumer()
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/awslogs/core.py", line 172, in consumer
    for event in generator():
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/awslogs/core.py", line 159, in generator
    response = self.client.filter_log_events(**kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/client.py", line 565, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/client.py", line 1001, in _make_api_call
    http, parsed_response = self._make_request(
                            ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/client.py", line 1027, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/endpoint.py", line 119, in make_request
    return self._send_request(request_dict, operation_model)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/endpoint.py", line 198, in _send_request
    request = self.create_request(request_dict, operation_model)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/endpoint.py", line 134, in create_request
    self._event_emitter.emit(
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/hooks.py", line 412, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/hooks.py", line 256, in emit
    return self._emit(event_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/hooks.py", line 239, in _emit
    response = handler(**kwargs)
               ^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/signers.py", line 105, in handler
    return self.sign(operation_name, request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/signers.py", line 190, in sign
    auth = self.get_auth_instance(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/signers.py", line 310, in get_auth_instance
    frozen_credentials = credentials.get_frozen_credentials()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/credentials.py", line 634, in get_frozen_credentials
    self._refresh()
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/credentials.py", line 522, in _refresh
    self._protected_refresh(is_mandatory=is_mandatory_refresh)
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/credentials.py", line 538, in _protected_refresh
    metadata = self._refresh_using()
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/credentials.py", line 685, in fetch_credentials
    return self._get_cached_credentials()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/credentials.py", line 695, in _get_cached_credentials
    response = self._get_credentials()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/credentials.py", line 2150, in _get_credentials
    token = initial_token_data.get_frozen_token().token
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/tokens.py", line 82, in get_frozen_token
    self._refresh()
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/tokens.py", line 95, in _refresh
    self._protected_refresh()
  File "/opt/homebrew/Cellar/awslogs/0.15.0_1/libexec/lib/python3.12/site-packages/botocore/tokens.py", line 122, in _protected_refresh
    raise TokenRetrievalError(
botocore.exceptions.TokenRetrievalError: Error when retrieving token from sso: Token has expired and refresh failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant