Skip to content

[BUG] express-session resave required despite touch being implemented #82

@delfuego

Description

@delfuego

Describe the bug
According to the express-session docs, the resave option should be able to safely be set to false if a given session store implements the touch method. This store (connect-mssql-v2) appears to implement touch, but in my testing, I am not seeing the sessions properly resaved without setting express-session's resave option to true.

To Reproduce
Steps to reproduce the behavior:

  1. Implement a web app using express-session and connect-mssql-v2, setting express-session's cookie.maxAge setting to something (e.g., 1000 * 60 * 30 for 30 minutes), rolling to true, and resave to false.
  2. Load a page from the web app, so a new session is established and saved to the MS SQL database.
  3. View the session in the DB, noting the value of session.cookie.expires in the session data.
  4. Reload the page from the web app.
  5. View the session info again in the DB, noting that the value of session.cookie.expires is not updated.
  6. Quit the web app, and change the value of express-session's resave config option to true.
  7. Restart the web app.
  8. Load a page again.
  9. Note the session info in the DB, specifically the session.cookie.expires value.
  10. Reload the page.
  11. Finally, note the session info in the DB, specifically that the session.cookie.expires value has been updated properly.

Expected behavior
I would expect that the session information would be resaved even without the resave option set to true, given what is in the express-session documentation.

Desktop (please complete the following information):

  • Node Version: 22.15.0
  • Package Version: express-session 1.18.1, connect-mssql-v2 5.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions