var originalPath = parseUrl.original(req).pathname || '/'
^
TypeError: Cannot read property 'pathname' of undefined
at session (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\express-session\index.js:194:46)
at parseCookie (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\passport.socketio\lib\index.js:11:3)
at Array.<anonymous> (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\passport.socketio\lib\index.js:66:19)
at run (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\socket.io\lib\namespace.js:123:11)
at Namespace.run (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\socket.io\lib\namespace.js:135:3)
at Namespace.add (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\socket.io\lib\namespace.js:163:8)
at Client.connect (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\socket.io\lib\client.js:76:20)
at Server.onconnection (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\socket.io\lib\index.js:398:10)
at emitOne (events.js:96:13)
at Server.emit (events.js:188:7)
at Server.handshake (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\engine.io\lib\server.js:339:8)
at C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\engine.io\lib\server.js:235:12
at Server.checkRequest (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\socket.io\lib\index.js:73:51)
at Server.verify (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\engine.io\lib\server.js:171:17)
at Server.handleRequest (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\engine.io\lib\server.js:225:8)
at Server.<anonymous> (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\engine.io\lib\server.js:468:14)
at Server.<anonymous> (C:\Users\Malin\PhpstormProjects\mafiaapp\node_modules\socket.io\lib\index.js:307:16)
at emitTwo (events.js:106:13)
at Server.emit (events.js:191:7)
at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:548:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
[ app.use(session({
cookieName: 'session',
duration: 30* 30 * 60 * 1000,
secret: 'keyboard cat',
resave: true,
store: new MongoStore({ mongooseConnection: mongoose.connection }),
saveUninitialized: true,
cookie: {
secure: false,
expires: false,
}
}));
io.use(passportSocketIo.authorize({
cookieParser: session, // the same middleware you registrer in express
key: 'session', // the name of the cookie where express/connect stores its session_id
secret: 'keyboard catt', // the session_secret to parse the cookie
store: new MongoStore({ mongooseConnection: mongoose.connection }), // we NEED to use a sessionstore. no memorystore please
}));](url)
what am i doing wrong?