You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.26.2
Plugin version
10.7.0
Node.js version
20.11.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
5.15.150-1-MANJARO
Description
I am trying to regenerate a session in one of my routes to make sure whatever data is in there is reset and I would prefer to also get a new session id as I am essentially restarting the session.
But as far as I can see there is no way for me, without manually interacting with the SessionStore myself, to delete the old session id.
#regenerate only generates a new session for me and stores it.
I am essentially generating a completely new session with different ID and data/content.
I'd expect the session to be automatically deleted from the store as it is no longer used/needed.
As far as I can see, there is also no good workaround for this as calling await request.session.destroy(); before regenerating the session sets it to null causing TypeError: Cannot read properties of null (reading 'regenerate')
The text was updated successfully, but these errors were encountered:
letsession=request.session;awaitsession.destroy();awaitsession.regenerate();session=null;// just to make sure you don't use it or session = request.session
Prerequisites
Fastify version
4.26.2
Plugin version
10.7.0
Node.js version
20.11.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
5.15.150-1-MANJARO
Description
I am trying to regenerate a session in one of my routes to make sure whatever data is in there is reset and I would prefer to also get a new session id as I am essentially restarting the session.
But as far as I can see there is no way for me, without manually interacting with the SessionStore myself, to delete the old session id.
#regenerate
only generates a new session for me and stores it.Steps to Reproduce
Something like:
For easier understanding on what is happening in the store:
Expected Behavior
I am essentially generating a completely new session with different ID and data/content.
I'd expect the session to be automatically deleted from the store as it is no longer used/needed.
As far as I can see, there is also no good workaround for this as calling
await request.session.destroy();
before regenerating the session sets it tonull
causingTypeError: Cannot read properties of null (reading 'regenerate')
The text was updated successfully, but these errors were encountered: