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

HTTP 500 in connected services #539

Open
leafty opened this issue Nov 20, 2024 · 2 comments
Open

HTTP 500 in connected services #539

leafty opened this issue Nov 20, 2024 · 2 comments

Comments

@leafty
Copy link
Member

leafty commented Nov 20, 2024

To investigate:

Srv 0 2024-11-20 07:57:21 +0000 ERROR: Exception occurred while handling uri: 'https://dev.renku.ch/api/data/oauth2/connections/01HYZ9X2VZAY87988991JA2J48/installations?per_page=100'
Traceback (most recent call last):
  File "handle_request", line 102, in handle_request
    if TYPE_CHECKING:
                      
  File "/app/env/lib/python3.12/site-packages/renku_data_services/base_api/auth.py", line 39, in decorated_function
    response = await f(request, user, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/renku_data_services/base_api/misc.py", line 93, in decorated_function
    return await validate(query=query)(f)(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/sanic_ext/extras/validation/decorator.py", line 75, in decorated_function
    retval = await retval
             ^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/renku_data_services/base_api/pagination.py", line 90, in decorated_function
    items, db_count = await f(request, *args, **kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/renku_data_services/connected_services/blueprints.py", line 205, in _get_installations
    installations_list = await self.connected_services_repo.get_oauth2_app_installations(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/renku_data_services/connected_services/db.py", line 346, in get_oauth2_app_installations
    response = await oauth2_client.get(request_url, params=params, headers=adapter.api_common_headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/httpx/_client.py", line 1814, in get
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/authlib/integrations/httpx_client/oauth2_client.py", line 86, in request
    await self.ensure_active_token(self.token)
  File "/app/env/lib/python3.12/site-packages/authlib/integrations/httpx_client/oauth2_client.py", line 113, in ensure_active_token
    await self.refresh_token(url, refresh_token=refresh_token)
  File "/app/env/lib/python3.12/site-packages/authlib/integrations/httpx_client/oauth2_client.py", line 149, in _refresh_token
    token = self.parse_response_token(resp)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/authlib/oauth2/client.py", line 355, in parse_response_token
    raise self.oauth_error_class(
authlib.integrations.base_client.errors.OAuthError: bad_refresh_token: The refresh token passed is incorrect or expired.
ERROR:sanic.error:Exception occurred while handling uri: 'https://dev.renku.ch/api/data/oauth2/connections/01HYZ9X2VZAY87988991JA2J48/installations?per_page=100'
Traceback (most recent call last):
  File "handle_request", line 102, in handle_request
    if TYPE_CHECKING:
                      
  File "/app/env/lib/python3.12/site-packages/renku_data_services/base_api/auth.py", line 39, in decorated_function
    response = await f(request, user, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/renku_data_services/base_api/misc.py", line 93, in decorated_function
    return await validate(query=query)(f)(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/sanic_ext/extras/validation/decorator.py", line 75, in decorated_function
    retval = await retval
             ^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/renku_data_services/base_api/pagination.py", line 90, in decorated_function
    items, db_count = await f(request, *args, **kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/renku_data_services/connected_services/blueprints.py", line 205, in _get_installations
    installations_list = await self.connected_services_repo.get_oauth2_app_installations(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/renku_data_services/connected_services/db.py", line 346, in get_oauth2_app_installations
    response = await oauth2_client.get(request_url, params=params, headers=adapter.api_common_headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/httpx/_client.py", line 1814, in get
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/authlib/integrations/httpx_client/oauth2_client.py", line 86, in request
    await self.ensure_active_token(self.token)
  File "/app/env/lib/python3.12/site-packages/authlib/integrations/httpx_client/oauth2_client.py", line 113, in ensure_active_token
    await self.refresh_token(url, refresh_token=refresh_token)
  File "/app/env/lib/python3.12/site-packages/authlib/integrations/httpx_client/oauth2_client.py", line 149, in _refresh_token
    token = self.parse_response_token(resp)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/env/lib/python3.12/site-packages/authlib/oauth2/client.py", line 355, in parse_response_token
    raise self.oauth_error_class(
authlib.integrations.base_client.errors.OAuthError: bad_refresh_token: The refresh token passed is incorrect or expired.
Srv 0 2024-11-20 07:57:21 +0000 INFO: Token refreshed!
INFO:sanic.root:Token refreshed!
SendEvents 2024-11-20 07:57:22 +0000 INFO: sent 0 events
Srv 0 2024-11-20 07:57:22 +0000 INFO: Token refreshed!
INFO:sanic.root:Token refreshed!
SendEvents 2024-11-20 07:57:23 +0000 INFO: sent 0 events

Concurrent log:

Srv 0 2024-11-20 07:57:19 +0000 INFO: Token refreshed!
INFO:sanic.root:Token refreshed!
@leafty
Copy link
Member Author

leafty commented Nov 20, 2024

Note that refreshing the UI worked; the UI got the expected responses after a browser refresh.

@Panaetius
Copy link
Member

I think this is a duplicate of #446

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

2 participants