pydantic / FastUI

Build better UIs faster.
https://fastui-demo.onrender.com
MIT License
7.76k stars 297 forks source link

raise AuthRedirect is not working #319

Open ITWeirdRunner opened 1 month ago

ITWeirdRunner commented 1 month ago

raise AuthRedirect('/auth/login/password') is not working when I use it like in demo Traceback (most recent call last): File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__ return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ await self.middleware_stack(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__ await self.middleware_stack(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 72, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 269, in app solved_result = await solve_dependencies( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/fastapi/dependencies/utils.py", line 602, in solve_dependencies solved = await run_in_threadpool(call, **sub_values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool return await anyio.to_thread.run_sync(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/src/auth_user.py", line 28, in from_request raise AuthRedirect('/auth/login/password') fastui.auth.shared.AuthRedirect: Auth redirect to/auth/login/password INFO: 127.0.0.1:59513 - "GET /api/auth/profile HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__ return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ await self.middleware_stack(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__ await self.middleware_stack(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/routing.py", line 72, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 269, in app solved_result = await solve_dependencies( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/fastapi/dependencies/utils.py", line 602, in solve_dependencies solved = await run_in_threadpool(call, **sub_values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool return await anyio.to_thread.run_sync(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/opensource/PycharmProjects/be_happy.intefrace/src/auth_user.py", line 28, in from_request raise AuthRedirect('/auth/login/password') fastui.auth.shared.AuthRedirect: Auth redirect to/auth/login/password

shroominic commented 2 weeks ago

same for me