Node.bcrypt.js: bcrypt on AWS Lambda

Created on 18 Apr 2017  路  4Comments  路  Source: kelektiv/node.bcrypt.js

Thanks for reporting a new issue with the node bcrypt module!

To help you resolve your issue faster please make sure you have done the following:

  • Searched existing issues (even closed ones) for your same problem
  • Make sure you have installed the required dependencies listed on the readme
  • Read your npm error log for lines telling you what failed, usually it is a problem with not having the correct dependencies installed to build the native module

Once you have done the above and are still confident that the issue is with the module, please describe it below. Some things that really help get your issue resolved faster are:

  • What went wrong?

When using bcrypt, received an error:

Tue Apr 18 08:51:22 UTC 2017 : Endpoint response body before transformations: {"errorMessage":"/var/task/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header","errorType":"Error","stackTrace":["Object.Module._extensions..node (module.js:434:18)","Module.load (module.js:343:32)","Function.Module._load (module.js:300:12)","Module.require (module.js:353:17)","require (internal/module.js:12:17)","Object.<anonymous> (/var/task/node_modules/bcrypt/bcrypt.js:6:16)","Module._compile (module.js:409:26)","Object.Module._extensions..js (module.js:416:10)","Module.load (module.js:343:32)"]}
  • What did you expect to happen?

Not have this error, hash the password.

There is some information on native modules for AWS Lambda here: https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/. However, I am unsure on what steps I would need to take to build bcrypt to make it work. Any guidance would be much appreciated.

  • Which version of nodejs and OS?

4.3, AWS Lambda

  • If you find a bug, please write a failing test.

Thanks!

P.S. If it doesn't look like you read the above then your issue will likely be closed without further explanation. Sorry, but there are just too many issues opened with no useful information or questions which have been previously addressed.

Most helpful comment

An alternative is to use bcryptjs, with zero dependencies and still compatible with C++ bcrypt.

All 4 comments

You have to compile the module in an Amazon Linux instance first, using the same version of NodeJS as available in lambda, then zip the directory and deploy.
Instructions for Amazon Linux:
https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#rhel-and-centos

An alternative is to use bcryptjs, with zero dependencies and still compatible with C++ bcrypt.

Hi, I'm stuck in a problem with bcryptjs, maybe you could share some light in this dark tunnel...
My post with the issue: https://github.com/kelektiv/node.bcrypt.js/issues/75

Thx in advance!!

Same problem here.

The answer to spin up an amazon linux docker image or an ec2 instance just to compile the library with the same NodeJS version and the blood of a virgin then move it back to your local repository, and include it in the bundled zipfile sounds too crazy to me.

The other bcrypt library worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

enneid picture enneid  路  5Comments

alanosman picture alanosman  路  3Comments

youngrrrr picture youngrrrr  路  5Comments

jferrettiboke picture jferrettiboke  路  4Comments

thorlacius picture thorlacius  路  4Comments