-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
res.redirect happening before req.flash #195
Comments
It's a race condition. User gets redirected to new page before session gets saved on database. Try executing a |
@franckl Any updates ? |
Ok it's not related to |
For people who come across this in future searching... I was halfway through rolling my own new version of
And lo, I had these lines: app.use(require('cookie-parser')())
const session = require('express-session')
const MongoStore = require('connect-mongo')(session)
app.use(session({
secret: process.env.SESSION_STORE_SECRET,
store: new MongoStore({mongooseConnection: mongoose.connection}),
maxAge: 10*365*24*60*60*1000, // set to 10 years
resave: false,
saveUninitialized: false
})) Once I changed the app.use(require('cookie-parser')(process.env.SESSION_STORE_SECRET))` it worked exactly as expected! (For some people, the answer will be to remove |
Hi Jerome,
It seems connect-mongo is causing the issue referenced below :
jaredhanson/connect-flash#23 (comment)
What do you think ?
The text was updated successfully, but these errors were encountered: