Closed fynnlyte closed 11 months ago
I have run into this issue as well. In my case, I think that this happened because I had an entry in inactiveSessions
, but the session was still present in _users
, resulting in a conflict error when trying to reuse the session (it tries to create a new _users
entry with the same _id
and no _rev
, thus the conflict error).
I don't know why this happened, it seems pretty unusual, maybe my databases has crashed, or there was another random error in the middle of logoutSession()
or removeExpiredKeys()
...
In case you need a way to reproduce it:
sl-users
, put your session's ID in inactiveSessions
, and delete session
Just for information, if someone needs it: the fix is already merged to master of this repo, but no new release published to npm. I've done that for my fork, see https://www.npmjs.com/package/@klues/couch-auth. It includes the fix and we're using it in production until a new release is published for this repo.
If CouchDB or the express server crashes in the middle of processing a login request, a session token might already be generated but that token is not yet documented within
sl-users
. This leads to errors as:Such conflicts should be resolved automatically. In case of a conflict error when creating the entry in
_users
: