Skip to content

Transient Session Token Errors #295

@cassidysymons

Description

@cassidysymons

Since re-launch, I've observed a few instances of transient exceptions where the "token" key doesn't exist in the session scope. My initial suspicion was it was a situation where browsers were left open, sessions expired, and there was some scenario where the expiration wasn't handled gracefully. However, there was an error yesterday where the participant was actively using the system, the exception occurred, then they went on using the system successfully.

  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/connexion/decorators/decorator.py", line 48, in wrapper
    response = function(request)
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/connexion/decorators/uri_parsing.py", line 144, in wrapper
    response = function(request)
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/connexion/decorators/validation.py", line 384, in wrapper
    return function(request)
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/connexion/decorators/produces.py", line 38, in wrapper
    response = function(request)
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/connexion/decorators/response.py", line 103, in wrapper
    response = function(request)
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/connexion/decorators/parameter.py", line 121, in wrapper
    return function(**kwargs)
  File "/Users/api_user/microsetta-interface-2023.10/microsetta_interface/implementation.py", line 2196, in get_reconsent
    need_reconsent = check_current_consent(
  File "/Users/api_user/microsetta-interface-2023.10/microsetta_interface/implementation.py", line 3557, in check_current_consent
    has_error, consent_required, _ = ApiRequest.get(
  File "/Users/api_user/microsetta-interface-2023.10/microsetta_interface/implementation.py", line 3618, in get
    auth=BearerAuth(session[TOKEN_KEY_NAME]),
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/werkzeug/local.py", line 377, in <lambda>
    __getitem__ = lambda x, i: x._get_current_object()[i]
  File "/Users/api_user/miniconda3/envs/microsetta-interface/lib/python3.8/site-packages/flask/sessions.py", line 84, in __getitem__
    return super(SecureCookieSession, self).__getitem__(key)
KeyError: 'token'

The exception has occurred on a few different paths - registering an FFQ, reconsenting, and viewing a signed consent - so it doesn't seem to be a path-specific issue. This is not high-urgency, as in all instances, the users have been able to continue using the system. However, I plan to look into potential causes and resolution after clearing the list of development tasks necessary for hard launch.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions