Is there a quick way to resolve this inconsistent ...
# support-questions-legacy
d
Is there a quick way to resolve this inconsistent mode warning when running alembic migrations in fastapi?
Copy code
$ alembic upgrade XXXX
venv/lib/python3.10/site-packages/supertokens_python/utils.py:197: RuntimeWarning: Inconsistent mode detected, check if you are using the right asgi / wsgi mode
My supertokens init in thread
Copy code
supertokens.init(
        app_info=supertokens.InputAppInfo(
            app_name="Nooks for Books",
            api_domain=API_DOMAIN,
            website_domain=WEB_DOMAIN,
            api_base_path="/auth",
            website_base_path="/auth"
        ),
        supertokens_config=supertokens.SupertokensConfig(
            connection_uri=SUPERTOKENS_CONN_URI,
            api_key=SUPERTOKENS_API_KEY,
        ),
        framework='fastapi',
        recipe_list=[
            session.init(), # initializes session features
            passwordless.init(
                flow_type="USER_INPUT_CODE",
                contact_config=passwordless.ContactEmailOnlyConfig()
            ),
            dashboard.init(api_key=SUPERTOKENS_API_KEY),
        ],
        mode='asgi'
    )
r
@KShivendu can help here.
k
@davidrusu is supertokens actually affecting your migration? It's just a warning that you can resolve easily by changing the mode (programmatically or by hardcoding depending on how you're running the script)
d
No, it doesn't affect the migration, but adds log noise (distracting from other important stuff)
I guess the ideal scenario would be to skip supertokens init if not running in the specified mode?
k
> skip supertokens init if not running in the specified mode? yeah you can do that as well. See if there's a env var or something to differentiate them programmatically. simplest but not-so-clean solution would to just check sys.argv