Open genbuzz opened 2 months ago
Having the same issue – from what I could tell we have to define a custom type by inheriting from rx.Base
[1] but if you look at the implementation of the User
object, it doesn't [2]... so it may be throwing an error preemptively
I can successfully print the User object (and I see all of the associated fields) but I can't access any of them
[1] https://reflex.dev/docs/vars/custom-vars/ [2] https://github.com/kroo/reflex-clerk/blob/02540611f00094498dc635ed98a4ac68e19bc420/custom_components/reflex_clerk/clerk_client/clerk_response_models.py#L310
Updating here in case helpful: it worked when I updated the implementation to inherit from rx.Base
– if I have time I can try to push a PR but not sure that this repo is being actively maintained?
I am getting reflex.utils.exceptions.VarAttributeError: The State var has no attribute 'first_name' any time I use one of the attributes of the user the clerk.ClerkState.user my application does not launch with reflex run: reflex.utils.exceptions.VarAttributeError: The State var has no attribute 'first_name'
snip code: return clerk.clerk_provider(rx.vstack( clerk.signed_in( rx.fragment("You are logged in as ", clerk.ClerkState.user_id, clerk.ClerkState.user.first_name) ),
full trace: Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64qbz5n2kfra8p0\Lib\multiprocessing\process.py", line 314, in _bootstrap self.run() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\process.py", line 108, in run", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\reflex\app_module_for_backend.py", line 20, in
app._apply_decorated_pages()
File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\reflex\app.py", line 801, in _apply_decorated_pages
self.add_page(render, **kwargs)
File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\reflex\app.py", line 519, in add_page
component = self._generate_component(component)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\reflex\app.py", line 441, in _generate_component
return component if isinstance(component, Component) else component()
^^^^^^^^^^^
File "C:\Users\marce\PycharmProjects\genbuzzapp\genbuzzapp\templates\template.py", line 126, in theme_wrap
templated_page(),
^^^^^^^^^^^^^^^^
File "C:\Users\marce\PycharmProjects\genbuzzapp\genbuzzapp\templates\template.py", line 88, in templated_page
page_content(),
^^^^^^^^^^^^^^
File "C:\Users\marce\PycharmProjects\genbuzzapp\genbuzzapp\pages\index.py", line 58, in index
rx.fragment("You are logged in as ", clerk.ClerkState.user_id, clerk.ClerkState.user.first_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\reflex\vars\base.py", line 841, in getattr__
raise VarAttributeError(
reflex.utils.exceptions.VarAttributeError: The State var has no attribute 'first_name' or may have been annotated wrongly.
self._target(*self._args, **self._kwargs) File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\uvicorn_subprocess.py", line 76, in subprocess_started target(sockets=sockets) File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\uvicorn\server.py", line 61, in run return asyncio.run(self.serve(sockets=sockets)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64qbz5n2kfra8p0\Lib\asyncio\runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\uvicorn\server.py", line 68, in serve config.load() File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\uvicorn\config.py", line 467, in load self.loaded_app = import_from_string(self.app) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\marce\PycharmProjects\genbuzzapp.venv\Lib\site-packages\uvicorn\importer.py", line 21, in import_from_string module = importlib.import_module(module_str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64qbz5n2kfra8p0\Lib\importlib\init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "