koajs / generic-session

koa session store with memory, redis or others.
MIT License
414 stars 65 forks source link

not working with koa2 and koa-convert #101

Closed JJPandari closed 7 years ago

JJPandari commented 7 years ago

My colleague and I just started a new project and decided to use koa2 (used koa1 in last project). For generic session, I now have config like this:

app.use(convert(
    session({
        store: new MongoStore({
            db: config.MongoDB.NAME
        }),
        cookie: {
            maxage: 86400000
        }
    })
));

which just adds a convert to my config for session in last project. Generic-session worked well in last project, and convert works well with other koa plugins and our legacy controllers. I tried to debug the app and ctx.session is undefined. Does this have something to do with the middlewares' syntax changing from function* (next) {this.body='res text';} to async function(ctx,next) {ctx.body='res text';}?

iliakan commented 7 years ago

are you sure? post the whole code please.