question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Session never destroyed

See original GitHub issue

Hi, I’m using generic-session with koa-redis on a side project and can’t figure out how to destroy the session. I mean, I have a /logout route that is suppose to destroy the current session with the following code:

router.get('/logout', function *() {
  console.log('logout');
  this.session = null;
  this.status = 200;
});

As mentioned in the README.md, this.session = null should destroy the session but in fact nothing happened. I put some console.log in the destroy method of koa-redis and I noticed this function was never called.

FYI, modules versions are:

  • koa: 1.1.2
  • koa-generic-session: 1.10.0
  • koa-redis: 1.0.1 And session are created by koa-passport (1.x.x)

I try to make test in koa-redis and koa-generic-session and everything works as expected, 100% passed.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dead-horsecommented, Apr 9, 2016

added some test cases for rolling session, anybody can reproduce the issue and create a test case?

https://github.com/koajs/generic-session/commit/0b1d52eb32aa0ace4c997277542decae4b07c2ec

0reactions
tonystaarkcommented, Nov 12, 2020

The bug as raised by @miserylee is still there. How can we mitigate this issue if we need to use rolling:true for every request while making sure the session was destroyed if we call it to destroy?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Session data not destroyed after returning to previous page in ...
I intended to send new session data each time, deleting the previous. session_destroy(); $_SESSION['showvals'] = array();. None of this worked.
Read more >
How to destroy a session when the listen server host closes ...
Basically, I'm just looking for a good place to call my destroy session function for when you're disconnected by the server. I'm using...
Read more >
session_destroy - Manual - PHP
session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the...
Read more >
Do you expect the entire session to be destroyed when ...
I'm currently thinking about what happens when I log out of a website, and how that applies to Community Auth. Right now, when...
Read more >
Control the Session with Spring Security - Baeldung
For a more stateless application, the “never” option will ensure that Spring Security itself won't create any session.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found