While implementing passport and working the backend for it i got this error. Could anyone help me figure out how to fix it? 

> 
> TypeError: Cannot read property 'password' of undefined
>  at Query.\_callback (/Users/oscarstein/Documents/Programering/express-cc/app.js:76:32)
> 
> 
> 

Using the following code: 

```
passport.use(new LocalStrategy(
  function(username, password, done) {
      console.log(username);
      console.log(password);
      const db = require('./db');

      db.query('SELECT id, password FROM users WHERE username = ?', [username], function(err, results, fields){
        if (err) {done(err)};

        if (results.length == 0) {
          done(null, false);
        }

        const hash = results[0].password.toString();

        bcrypt.compare(password, hash, function(err, response){
            if (response == true) {
              return done(null, {user_id: results[0].id});
            } else {
              return done(null, false);
            }

          });
      })

    }
));

```