使用AWS Lambda执行时,即使我们在库中有提到的包,我也会收到下面给出的错误,已经安装了passlib库和bycrypt依赖项,还尝试了不同的python版本执行,同样的错误不断出现,对此毫无线索
[ERROR] 2021-12-19T07:18:10.597Z 9e6d8789-60d9-4b16-a8e7-4b20eacbdad9 Exception in 'http' protocol.
Traceback (most recent call last):
File "/var/task/mangum/protocols/http.py", line 81, in run
await app(self.request.scope, self.receive, self.send)
File "/var/task/fastapi/applications.py", line 208, in __call__
await super().__call__(scope, receive, send)
File "/var/task/starlette/applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "/var/task/starlette/middleware/errors.py", line 181, in __call__
raise exc
File "/var/task/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/var/task/starlette/exceptions.py", line 82, in __call__
raise exc
File "/var/task/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/var/task/starlette/routing.py", line 656, in __call__
await route.handle(scope, receive, send)
File "/var/task/starlette/routing.py", line 259, in handle
await self.app(scope, receive, send)
File "/var/task/starlette/routing.py", line 61, in app
response = await func(request)
File "/var/task/fastapi/routing.py", line 226, in app
raw_response = await run_endpoint_function(
File "/var/task/fastapi/routing.py", line 161, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/var/task/starlette/concurrency.py", line 39, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/var/task/anyio/to_thread.py", line 28, in run_sync
return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable,
File "/var/task/anyio/_backends/_asyncio.py", line 818, in run_sync_in_worker_thread
return await future
File "/var/task/anyio/_backends/_asyncio.py", line 754, in run
result = context.run(func, *args)
File "/var/task/api/v1/endpoints/routers/authentication.py", line 37, in login
if not Hash.verify(request.password, user.password):
File "/var/task/api/v1/endpoints/utils/hashing.py", line 11, in verify
return pwd_ctx.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')
1条答案
按热度按时间wqsoz72f1#
在要求中尝试使用不同版本的加密和bcrypt,AWS Lambda运行时上的GLIBC存在兼容性问题