Flash messages being cleared

Hi folks,

Having an issue with connect-flash at the moment. I set a flash message when processing one route, and then redirect to another - e.g. update a users credentials, and then go to the ‘all users’ page.

After updating a user, I show a flash message ‘users updated’ … half the time it works, the rest … nothing.

In my app.js I have:

app.use(function(req, res, next) {
  res.locals.success_msg = req.flash('success_msg');

If I put a console.log() in there to show the value of res.locals.success_msg, often it is empty before the redirect is handled …

Any thoughts are very welcome!