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

Session timeout during longer operations results in 203 error code and API-related exception #32

Open
jeffshurtliff opened this issue Apr 13, 2021 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jeffshurtliff
Copy link
Owner

When performing longer operations such as looping through a list of users to subscribe them to nodes, if the process takes long enough for the authentication session to timeout then it will cause the subsequent API call to potentially return a 203 error and raise one of the API-related exceptions. This is demonstrated in the stacktrace below.

Traceback (most recent call last):
  File "adhoc/khoros/auto_subscribe.py", line 330, in <module>
    main()
  File "adhoc/khoros/auto_subscribe.py", line 293, in main
    results = subscribe_to_advisories(user_lists, opted_in_users)
  File "adhoc/khoros/auto_subscribe.py", line 264, in subscribe_to_advisories
    added_data.update(add_to_opted_in_role(user, product))
  File "adhoc/khoros/auto_subscribe.py", line 174, in add_to_opted_in_role
    response = khoros.roles.assign_roles_to_user(user, 'login', role_name)
  File "/usr/local/lib/python3.6/site-packages/khoros/core.py", line 3034, in assign_roles_to_user
    node, node_type, v1, return_json)
  File "/usr/local/lib/python3.6/site-packages/khoros/objects/roles.py", line 491, in assign_roles_to_user
    response = _assign_role_with_v2(khoros_object, user, lookup_type, roles_to_add, node, node_type)
  File "/usr/local/lib/python3.6/site-packages/khoros/objects/roles.py", line 419, in _assign_role_with_v2
    _user_id = users.get_user_id(_khoros_object, login=_user)
  File "/usr/local/lib/python3.6/site-packages/khoros/objects/users.py", line 522, in get_user_id
    user_id = _get_user_identifier(khoros_object, 'id', where_clause, allow_multiple, display_warnings)
  File "/usr/local/lib/python3.6/site-packages/khoros/objects/users.py", line 470, in _get_user_identifier
    _api_response = liql.perform_query(_khoros_object, liql_query=_liql_query, verify_success=True)
  File "/usr/local/lib/python3.6/site-packages/khoros/liql.py", line 175, in perform_query
    raise errors.exceptions.GETRequestError(error_msg)
khoros.errors.exceptions.GETRequestError: The Community API v2 call failed with the error code '203' and the following message: You are not authorized to make this request (Error Type: error_data)

Action needs to be taken to ensure that timed out sessions are re-initiated as necessary to prevent these failures.

@jeffshurtliff jeffshurtliff added the bug Something isn't working label Apr 13, 2021
@jeffshurtliff jeffshurtliff self-assigned this Apr 13, 2021
@jeffshurtliff jeffshurtliff added this to the v4.4.0 milestone Oct 3, 2021
@jeffshurtliff jeffshurtliff modified the milestones: v4.4.0, v4.5.0 Oct 12, 2021
@jeffshurtliff jeffshurtliff modified the milestones: v4.5.0, v4.6.0 Jan 16, 2022
@jeffshurtliff jeffshurtliff modified the milestones: v5.1.0, v6.0.0 Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant