Skip to content

fix: auth-react server flake #584

@namsnath

Description

@namsnath

multitenancy.mock.test.js

multitenancy.tenant_interactions.test.js

Seems like a race condition in should keep the session active if even if dynamic login methods is enabled.
The loginmethods endpoint returns a 500, which fails the test. The test is flakey and passes locally and on re-runs.

mfa.chooserscreen.test.js

Error in /auth/mfa/info, which causes a 401 in /auth/session/refresh

Internal Server Error: /auth/mfa/info
Traceback (most recent call last):
  File "/home/runner/work/supertokens-python/supertokens-python/supertokens-python/venv/lib/python3.13/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/runner/work/supertokens-python/supertokens-python/supertokens-python/supertokens_python/framework/django/django_middleware.py", line 82, in __syncMiddleware
    result: Union[BaseResponse, None] = async_to_sync(st.middleware)(
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        custom_request, response, user_context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/runner/work/supertokens-python/supertokens-python/supertokens-python/venv/lib/python3.13/site-packages/asgiref/sync.py", line 254, in __call__
    return call_result.result()
           ~~~~~~~~~~~~~~~~~~^^
  File "/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/runner/work/supertokens-python/supertokens-python/supertokens-python/venv/lib/python3.13/site-packages/asgiref/sync.py", line 331, in main_wrap
    result = await self.awaitable(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/supertokens-python/supertokens-python/supertokens-python/supertokens_python/supertokens.py", line 648, in middleware
    request_handled = await final_matched_recipe.handle_api_request(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/home/runner/work/supertokens-python/supertokens-python/supertokens-python/supertokens_python/recipe/multifactorauth/recipe.py", line 153, in handle_api_request
    return await resync_session_and_fetch_mfa_info.handle_resync_session_and_fetch_mfa_info_api(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        tenant_id, self.api_implementation, options, user_context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/runner/work/supertokens-python/supertokens-python/supertokens-python/supertokens_python/recipe/multifactorauth/api/resync_session_and_fetch_mfa_info.py", line 45, in handle_resync_session_and_fetch_mfa_info_api
    response = await api_implementation.resync_session_and_fetch_mfa_info_put(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "/home/runner/work/supertokens-python/supertokens-python/supertokens-python/tests/auth-react/django3x/mysite/utils.py", line 909, in resync_session_and_fetch_mfa_info_put
    res = await og_resync_session_and_fetch_mfa_info_put(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        api_options, session, user_context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/runner/work/supertokens-python/supertokens-python/supertokens-python/supertokens_python/recipe/multifactorauth/api/implementation.py", line 139, in resync_session_and_fetch_mfa_info_put
    raise Exception(
    ...<2 lines>...
    )
Exception: The user is required to complete secondary factors they are not allowed to (otp-phone), likely because of configuration issues.
INFO:     127.0.0.1:55890 - "PUT /auth/mfa/info HTTP/1.1" 500 Internal Server Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions