Session: express-session deprecated undefined resave option

Created on 15 Feb 2015  路  1Comment  路  Source: expressjs/session

I use this for express app.js;

app.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))

but, confirm me:

express-session deprecated undefined resave option; provide resave option app.js:49:9
express-session deprecated undefined saveUninitialized option; provide saveUninitialized option app.js:49:9

and run confirm:

_http_outgoing.js:331
    throw new Error('Can\'t set headers after they are sent.');

why?

question

Most helpful comment

@timepast for the "deprecated" messages, you can find more on the readme, but if you don't want to make an informed decision, the easiest way to silence those messages is to change your app.use to the following:

app.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }, resave: true, saveUninitialized: true }))

As for your displayed error, the messages are in no way related. We cannot assist you with that error unless you are able to post code we can run that reproduces the error, unfortunately.

>All comments

@timepast for the "deprecated" messages, you can find more on the readme, but if you don't want to make an informed decision, the easiest way to silence those messages is to change your app.use to the following:

app.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }, resave: true, saveUninitialized: true }))

As for your displayed error, the messages are in no way related. We cannot assist you with that error unless you are able to post code we can run that reproduces the error, unfortunately.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nhitchins picture nhitchins  路  20Comments

skoranga picture skoranga  路  30Comments

renehauck picture renehauck  路  16Comments

scaryguy picture scaryguy  路  16Comments

exapsy picture exapsy  路  23Comments