RestApi Oauth 504 “Not a valid Bcrypt Hash.” issue using: Nodejs + Expressjs + Postgresql

Solution for RestApi Oauth 504 “Not a valid Bcrypt Hash.” issue using: Nodejs + Expressjs + Postgresql
is Given Below:

I’m testing my endpoint in postman and cannot seem to get my post request to give a 200 response. My routes, controller, and models are set up and working when making a request to my signup endpoint but in postman, I keep getting 504 errors. I’m trying to conduct a basic authentication request.

    "error": "server_error",
    "error_description": "Not a valid BCrypt hash."
}
OAuthUsers.beforeSave = function(user) {
    if (user.changed('password')) {
      user.set('password', bcrypt.hash(user.get('password'), bcrypt.genSalt(10)));
    }
  };
  return OAuthUsers;
};