dcodeIO / bcrypt.js

Optimized bcrypt in plain JavaScript with zero dependencies.
Other
3.47k stars 264 forks source link

compareSync and compare not working on AWS lambda #96

Open gate3 opened 5 years ago

gate3 commented 5 years ago

I recently tried deploying an app using this library to aws lambda and the compareSync and compare functions didn't work, my lambda function just timed out. I'd like to believe this is due to a limitation on lambda's side but i decided to post and ask for help in case. Below is a sample of my code

const ApiBuilder = require('claudia-api-builder');
const api = new ApiBuilder();
const encryptionHelper = require('bcrypt-nodejs');

api.post('/auth/login', async function ({post:{username, password}}) {
  const user = await UserModel.findOne({ username })
  const pResult = encryptionHelper.compareSync(password, result.password)
  if(pResult){
    return 'Success'
  }else{
    return 'Not found'
  }
})

If it helps, I am deploying with claudiajs and claudiajs api builder and i am using the current version of this library

dcodeIO commented 5 years ago

require('bcrypt-nodejs') isn't this package