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

Typescript | Type '{ maxAge: number; }' is not assignable to type 'CookieOptions'. #277

Closed
MCarstensen opened this issue Dec 10, 2020 · 1 comment
Labels

Comments

@MCarstensen
Copy link

MCarstensen commented Dec 10, 2020

I'm trying to modify the maxAge so that when a user completes a sales funnel. This cookies expiration should change change from the default to 30 minutes so that they can see their receipt for that amount of time.

Unfortunately, the maxAge is showing an overload, saying it's not assignable to type 'CookieOptions' in typescript.

maxAge

import { Duration } from 'luxon';
import { SessionOptions } from 'next-iron-session';

const leadConfig: SessionOptions = {
  password: process.env.ironSessionPassword,
  cookieName: 'lead',
  cookieOptions: {
    secure: false,
    // secure: process.env.NODE_ENV === 'production',
    maxAge: Duration.fromObject({ hours: 8 }).as('seconds'),

  },
};

export default leadConfig;

While I'm not sure of the proper way to change the expiration on a session, the documentation shows that maxAge is available of cookieOptions.

@vvo vvo closed this as completed in c354a66 Feb 10, 2021
@vvo
Copy link
Owner

vvo commented Feb 10, 2021

🎉 This issue has been resolved in version 4.1.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

@vvo vvo added the released label Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants