Open ypliypli opened 6 years ago
@ypliypli can you please provide more of your code? It will help if you create a minimum repo which repoduces this error i.e. only koa and koa-session and some of your code. It will be event better if you can write a test.
I've used your code and added minimal code to init koa. There are no errors in my setup.
package.json:
"dependencies": {
"koa": "^2.6.2",
"koa-session": "^5.10.0"
},
app.js
const Koa = require('koa');
const app = new Koa();
const session = require('koa-session');
app.use(session({
key: 'koa:sess', /** (string) cookie key (default is koa:sess) */
/** (number || 'session') maxAge in ms (default is 1 days) */
/** 'session' will result in a cookie that expires when session/browser is closed */
/** Warning: If a session cookie is stolen, this cookie will never expire */
maxAge: 86400000,
overwrite: true, /** (boolean) can overwrite or not (default true) */
httpOnly: true, /** (boolean) httpOnly or not (default true) */
signed: true, /** (boolean) signed or not (default true) */
rolling: false, /** (boolean) Force a session identifier cookie to be set on every response. The expiration is reset to the original maxAge, resetting the expiration countdown. (default is false) */
renew: false, /** (boolean) renew session when session is nearly expired, so we can always keep user logged in. (default is false)*/
}, app));
app.listen(3000, () => console.log('Listening on port ' + 300));
is this issue solved? I met the same problem. And I am sure it has nothing to do with the version of koa and koa-session, as it works in my demo with the same version.
https://github.com/koajs/session/blob/622a2d803ff0d42ff1620e3c576b089b3725a65f/index.js#L39