I am using fastAPI and deployed API in Lambda functions. when testing login API (passlib[bcrypt] is used to hash password) throwing an Internal Server Error.
Traceback (most recent call last):
File "/var/task/mangum/protocols/http.py", line 58, in run
await app(self.scope, self.receive, self.send)
File "/var/task/fastapi/applications.py", line 282, in __call__
await super().__call__(scope, receive, send)
File "/var/task/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/var/task/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/var/task/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/var/task/starlette/middleware/cors.py", line 83, in __call__
await self.app(scope, receive, send)
File "/var/task/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/var/task/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/var/task/fastapi/middleware/asyncexitstack.py", line 20, in __call__
raise e
File "/var/task/fastapi/middleware/asyncexitstack.py", line 17, in __call__
await self.app(scope, receive, send)
File "/var/task/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/var/task/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/var/task/starlette/routing.py", line 66, in app
response = await func(request)
File "/var/task/fastapi/routing.py", line 241, in app
raw_response = await run_endpoint_function(
File "/var/task/fastapi/routing.py", line 169, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/var/task/starlette/concurrency.py", line 41, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/var/task/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/var/task/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/var/task/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/var/task/routes/users.py", line 28, in login
if user and verify_password(form_data.password, user.password):
File "/var/task/crud.py", line 15, in verify_password
return pwd_context.verify(plain_password, hashed_password)
File "/var/task/passlib/context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "/var/task/passlib/utils/handlers.py", line 792, in verify
return consteq(self._calc_checksum(secret), chk)
File "/var/task/passlib/handlers/bcrypt.py", line 591, in _calc_checksum
self._stub_requires_backend()
File "/var/task/passlib/utils/handlers.py", line 2254, in _stub_requires_backend
cls.set_backend()
File "/var/task/passlib/utils/handlers.py", line 2156, in set_backend
return owner.set_backend(name, dryrun=dryrun)
File "/var/task/passlib/utils/handlers.py", line 2176, in set_backend
raise default_error
passlib.exc.MissingBackendError: bcrypt: no backends available -- recommend you install one (e.g. 'pip install bcrypt')
python 3.10
which version is compatible with lambda?
I followed this steps https://repost.aws/knowledge-center/lambda-python-package-compatible but for now timed out