Error: Cannot read property ‘user’ of null when calling passport.serializeUser

so I have the next in my passport.js file:

const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;
var connection = require('./database');
const User = require('./models/user');

const verifyCallback = (username, password, done) => {

  User.findUser(username).then((user) => {
      return done(null, false);

    const isValid = User.validPassword(password, user[0].password).then((isValid)=>{

        return done(null, user);
        return done(null, false);

  .catch((err) =>{

const strategy = new LocalStrategy(verifyCallback);


passport.serializeUser((user, done) => {
  console.log(user + "n" +;

passport.deserializeUser((userId, done) => {
    .then((user) =>{
        done(null, user)
    .catch(err => done(err));

Everything works fine until the function passport.serializeUser which return the error Cannot read property 'user' of null
I don’t know where is the user param coming from, I was following a tutorial but the guy didn’t explained. How should I solve that error?

Go to Source
Author: Alex UnLimited

Error occured while trying to proxy to: localhost:3000/auth/google. http-proxy-middleware

Error occured while trying to proxy to: localhost:3000/auth/google. http-proxy-middleware

enter image description hereI have react-node-webpack app. I am implementing google oauth with passport.js. I need to use proxy server to make requests to google. this is my setup:

const { createProxyMiddleware } = require("http-proxy-middleware");

  ["/api", "/auth/google"],
    target: "", //I used localhost instead but same issue

when i start the server i see the message saying proxy is created.

       [HPM] Proxy created: /  ->

but when i visit the localhost:3000/auth/google i get this error

[HPM] Error occurred while trying to proxy request /api from localhost:3000 to (ECONNREFUSED) (

Go to Source
Author: Yilmaz