koajs / generic-session

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

Does not work with node v6.5 #97

Closed bishtawi closed 8 years ago

bishtawi commented 8 years ago

Hi,

I already opened up a bug in koa-convert, but I figured its worth opening one here as I am unsure of which lib isnt playing nicely with node v6.5.

I have a webapp that I built using the koa v2 framework. I use koa-convert, koa-generic-session and koa-redis to store user sessions in my redis instance. Since upgrading to node v6.5, my webapp fails with the following stacktrace:

TypeError: Cannot read property 'done' of undefined
      at next (/Users/dev/work/node_modules/co/index.js:98:14)
      at onFulfilled (/Users/dev/work/node_modules/co/index.js:69:7)
      at /Users/Stephen/dev/work/node_modules/co/index.js:54:5
      at Object.co (/Users/dev/work/node_modules/co/index.js:50:10)
      at next (/Users/dev/work/node_modules/co/index.js:99:29)
      at onFulfilled (/Users/dev/work/node_modules/co/index.js:69:7)

It worked fine with node v6.4. The stacktrace doesnt go past co, but through trial and error, I deleted a lot of third party libs and middleware and narrowed it down to this block of code:

app.use(convert(session({
  key: 'session',
  errorHandler(err, type, ctx) {
    console.error(err, type)
  },
  store: redisStore({ url: config.redis.url })
})))

which can be reduced to app.use(convert(session())) and still trigger the same bug.

I do not use the convert lib anywhere else in the app so I cannot quickly test to see if the issue is specifically in the convert or session lib.

bishtawi commented 8 years ago

Closing as its a bug in V8