bcrypt.js icon indicating copy to clipboard operation
bcrypt.js copied to clipboard

compareSync and compare not working on AWS lambda

Open gate3 opened this issue 6 years ago • 1 comments

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

gate3 avatar Mar 02 '19 13:03 gate3

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

dcodeIO avatar Mar 02 '19 13:03 dcodeIO