Skip to content
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

occur a waring #4

Closed
yuu2lee4 opened this issue Nov 28, 2016 · 3 comments
Closed

occur a waring #4

yuu2lee4 opened this issue Nov 28, 2016 · 3 comments

Comments

@yuu2lee4
Copy link

i use it with koa-generic-session-mongo like this:
app.use(session({
cookie: {maxAge: 1000 * 60 * 60 * 24 * 30},//30 days
store: new MongoStore()
}))

when i set: ctx.session.user = user , the shell tell me:
(node:12780) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'maxAge' of undefined

node version: 7.2.0

@lzztt
Copy link
Owner

lzztt commented Nov 28, 2016

Hi yuu2lee4,

I think this may be caused by an obsolete set interface implemented by koa-generic-session-mongo.

The correct interface should be set(sid, sess, ttl): set session object for sid, with a ttl (in ms), for both koa-session-minimal and koa-generic-session.

It works for koa-generic-session because koa-generic-session stores a copy of cookie options in each session record in database, which is explicitly removed by koa-session-minimal, because we believe that cookie options are not session data.

I will create an Issue for koa-generic-session-mongo.

@lzztt
Copy link
Owner

lzztt commented Nov 28, 2016

There is already an Issue opened. I will update that one.

@lzztt
Copy link
Owner

lzztt commented Dec 6, 2016

set interface has been updated in koa-generic-session-mongo

@lzztt lzztt closed this as completed Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants