vvo / iron-session

🛠 Secure, stateless, and cookie-based session library for JavaScript
https://get-iron-session.vercel.app
MIT License
3.65k stars 251 forks source link

session returned from `getIronSessionFromCookieStore` does not implement full interface #689

Closed brumm closed 4 months ago

brumm commented 9 months ago

Hey there,

We're using Nextjs's cookies() function. The session object returned from getIronSessionFromCookieStore does not include an implementation for updateConfig.

Our use case for updateConfig is to set a maxAge on the session that is not known until after logging in.

We've worked around this for now by allowing the getSession wrapper around getIronSession to pass new sessionOptions

export async function getSession(
  config: Partial<SessionOptions> = sessionOptions,
) {
  const session = getIronSession<SessionData>(
    cookies(),
    merge({}, sessionOptions, config),
  )
  return session
}
simpros commented 9 months ago

Same here - i am using v8.0.1

vvo commented 4 months ago

Fixes in 8.0.2