UnhandledPromiseRejectionWarning: Error: data and salt arguments required

UnhandledPromiseRejectionWarning: Error: data and salt arguments required

我遇到此代码错误:

async function get(user) {
  user = await Joi.validate(user, userSchemaGet, { abortEarly: false });
  await User.findOne(
    {_id: user._id}, 
    (err, res) => {
      if(err){
        console.log("ERROR : ")
        console.log(err)
      } else {
        console.log("res")
        console.log(res);
        if(bcrypt.hash(user.password, 10) === res.hashedPassword) {
          return res;
        }
      }
    });
}

我阅读了有关此主题的所有 Whosebug,但没有任何反应。 ps : 昨日一切正常...

1) 可能 user.password 为空或未定义。在将 user 值传递给 hash 函数之前检查它。

2) bcrypt.hash 是一个 promise,但您将其用作普通函数。

3) bcrypt 有一个特殊的比较功能,用于检查 passowrd 是否与哈希匹配。你应该在这里使用它。

Bcrypt docs