After making a deploy, I test the function and show this:

Hi Dsantacruz and welcome to the community.

The issue you mention is the fact that the environment under which your Lambda functions run on AWS is not the same as the environment you might run locally. Bcrypt has to be compiled for the environment in which it is going to execute since it is written in C and this means if you have to use that specific version there are some hoops you will need to jump through. These instructions should help you with that route: https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#rhel-and-centos

The alternative is to use a module called bcryptjs (https://github.com/dcodeIO/bcrypt.js) which does exactly the same thing but is written purely in JavaScript. The downside is that it will be a bit slower but this might be good enough for you.

2 Likes