I am trying to create a Python function for AWS Lambda that uses the passlib
library for password hashing with argon2
. To this end, I am using pip
to install the following packages in a local directory, zipping them with my Python file, and uploading to Lambda:
passlib==1.7.1
argon2-cffi==18.1.0
cffi==1.11.5
pycparser==2.18
six==1.11.0
These packages are sufficient to let me use argon2
through passlib
on my local Ubuntu environment. However, I keep getting the following error when testing in Lambda:
File "/var/task/my-function.py", line 41, in handler
if argon2.verify(password, hash):
File "/var/task/passlib/handlers/argon2.py", line 525, in verify
cls._stub_requires_backend()
File "/var/task/passlib/utils/handlers.py", line 2221, in _stub_requires_backend
cls.set_backend()
File "/var/task/passlib/utils/handlers.py", line 2143, in set_backend
raise default_error
passlib.exc.MissingBackendError: argon2: no backends available -- recommend you install one (e.g. 'pip install argon2_cffi')
In the Lambda console, it appears that everything is uploading as expected.
I would ideally like to know how to correctly package my Python application for Lambda, but would also accept other ways of doing argon2
or bcrypt
password hashing and hash verification in Lambda. Thanks in advance for all help!