koajs / generic-session

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

Deprecated "maxage"; use "maxAge" instead #104

Closed aendra-rininsland closed 4 years ago

aendra-rininsland commented 7 years ago

I get the following when I use koa-generic-session with koa-passport:

cookies deprecated "maxage"; use "maxAge" instead node_modules/koa-generic-session/lib/session.js:93:20

This may be a dupe of #83.

Invisible-Rabbit-Hunter commented 7 years ago

I also have this problem, whith koa 2 and koa-convert. I also get an error which may have to do whith this problem.

cookies deprecated "maxage"; use "maxAge" instead ../node_modules/koa-generic-session/lib/session.js:93:20

  koa-generic-session set error: .keys required for signed cookies
      at Cookies.set (/home/jonathan/Programming/javascript/chat-app/node_modules/cookies/lib/cookies.js:100:27)
      at Object.set (/home/jonathan/Programming/javascript/chat-app/node_modules/koa-generic-session/lib/session.js:93:20)
      at Object.saveNow (/home/jonathan/Programming/javascript/chat-app/node_modules/koa-generic-session/lib/session.js:283:26)
      at saveNow.next (<anonymous>)
      at onFulfilled (/home/jonathan/Programming/javascript/chat-app/node_modules/co/index.js:65:19)
moseleman commented 7 years ago

@in cookies 0.6.2 (come from cookies) maxage forced rewrite into maxAge koa2 inculdes cookies.

function compatMaxage(opts) {
  if (opts) {
    if(require('koa')) {
      delete opts.maxage;
      return;
    }
    opts.maxage = opts.maxage === undefined
      ? opts.maxAge
      : opts.maxage;
    delete opts maxAge;
  }
}

use it to replace in koa-generic-session/lib/session.js

dead-horse commented 7 years ago

can you send a PR for this?

dangolol commented 7 years ago

I also have this, and i send a PR for this but have some test problems on node 6.x. It's nothing to do with this PR