authx icon indicating copy to clipboard operation
authx copied to clipboard

raise NotImplementedError in BaseDBBackend

Open nickshanks347 opened this issue 3 years ago • 2 comments

First Check

  • [X] I added a very descriptive title to this issue.
  • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
  • [X] I already checked if it is not related to AuthX but to Pydantic.
  • [X] I already checked if it is not related to AuthX but to FastAPI.

Example Code

Following this example: https://github.com/yezz123/authx/blob/main/example/app/main.py

Description

I cloned the repository, and I'm trying out AuthX as it looks to be what I want. I've run into the following issues:

  1. A sqlite DB isn't generated. I can see in the BaseDBBackend class, there are a bunch of raise NotImplementedError, does this mean the BaseDBBackend isn't finished yet?
  2. When starting the app and navigating to /docs, I can see a bunch of endpoints, but the register endpoint, for example, doesn't let me put it any parameters.

When will the sqlite DB backend be finished?

Operating System

Linux

Operating System Details

No response

FastAPI Version

0.77.1

Python Version

3.10.4

Additional Context

image

nickshanks347 avatar Jul 01 '22 15:07 nickshanks347

Either way, regardless of the docs issue, this just doesn't seem to work:

ERROR:uvicorn.error:Exception in ASGI application
Traceback (most recent call last):
  File "/opt/python/latest/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/opt/python/latest/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/opt/python/latest/lib/python3.10/site-packages/fastapi/applications.py", line 269, in __call__
    await super().__call__(scope, receive, send)
  File "/opt/python/latest/lib/python3.10/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/opt/python/latest/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/opt/python/latest/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/opt/python/latest/lib/python3.10/site-packages/starlette/exceptions.py", line 93, in __call__
    raise exc
  File "/opt/python/latest/lib/python3.10/site-packages/starlette/exceptions.py", line 82, in __call__
    await self.app(scope, receive, sender)
  File "/opt/python/latest/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/opt/python/latest/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/opt/python/latest/lib/python3.10/site-packages/starlette/routing.py", line 670, in __call__
    await route.handle(scope, receive, send)
  File "/opt/python/latest/lib/python3.10/site-packages/starlette/routing.py", line 266, in handle
    await self.app(scope, receive, send)
  File "/opt/python/latest/lib/python3.10/site-packages/starlette/routing.py", line 65, in app
    response = await func(request)
  File "/opt/python/latest/lib/python3.10/site-packages/fastapi/routing.py", line 227, in app
    raw_response = await run_endpoint_function(
  File "/opt/python/latest/lib/python3.10/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
    return await dependant.call(**values)
  File "/workspaces/authx/authx/routers/auth.py", line 76, in register
    tokens = await service.register(data)
  File "/workspaces/authx/authx/services/auth.py", line 124, in register
    if await self._email_exists(user.email):
  File "/workspaces/authx/authx/services/auth.py", line 80, in _email_exists
    return await self._repo.get_by_email(email) is not None
  File "/workspaces/authx/authx/backend/api/crud.py", line 17, in get_by_email
    return await self._database.get_by_email(email)
AttributeError: 'str' object has no attribute 'get_by_email'

image

nickshanks347 avatar Jul 01 '22 16:07 nickshanks347

Hello @nickshanks347, as you know many of authx cases here are still in development progress like its still need much works for example the supporting of database still under development, (MongoDB is ready production support)

yezz123 avatar Jul 04 '22 17:07 yezz123