Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login only works if retries is not set to zero #96

Open
eavdmeer opened this issue Mar 30, 2021 · 1 comment
Open

Login only works if retries is not set to zero #96

eavdmeer opened this issue Mar 30, 2021 · 1 comment

Comments

@eavdmeer
Copy link

I had an application that was working just fine for over a year. I did, however, notice regular messages in the log, similar to this:

[session-file-store] will retry, error on last attempt: Error: ENOENT, open 'sessions/tRI6WeZEO2Uyvr4ZaUGW6_CU32RjvFpW.json'

That prompted me to do some research and someone mentioned using retries=0. I used that:

const store = new FileStore({ path: config.dirs.sessionDir, ttl: 86400s, retries: 0 });

As soon as I did that, my login form on login.html would log the user in (I could see the user object getting filled in). My code redirects from /login to home.html after a successful login. Every time, home.html was convinced there was no user and redirected back to login.html. If I would then manually try to go back to home.html in the browser, everything worked.

Changing the settings to: retries: 5, immediately fixed the problem. There appears to be a timing problem that requires a retry to always happen to check the session for the first request after a successful login.

@eavdmeer
Copy link
Author

This may be related to #94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant