Skip to content

Ensure session store complete before redirect #477

@eddiesholl

Description

@eddiesholl

I'm converting session storage for an app from MemoryStore to connect-couchdb. The login page is now flaky, and I think it is because the new session storage is slow enough that it has highlighted a race.

It looks like the successful login is redirecting (in our case successReturnToOrRedirect: '/'), and the 'session get' for / occurs before the 'session set' has written to the database. I've used some extra logging through the connect-couchdb and passport code to confirm this.

Is there a way to make sure req.session.save is called and completes before res.redirect gets called on success? The optional callback you can pass into authenticate() replaces all builtin handling, I was hoping for a solution where it can be augmented.

Any thoughts on this?

Cheers,

Eddie

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions