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

Using "pruneSessionInterval=false" will unexpectedly disable "createTableIfMissing=true" #279

Closed
Reiddd opened this issue May 17, 2023 · 3 comments

Comments

@Reiddd
Copy link

Reiddd commented May 17, 2023

Hi :)

I meet a weird issue in my product with connect-pg-simple 7.0.0. Here is my code

import PostgresStoreFactory from 'connect-pg-simple';
import session from 'express-session';

const PostgresStore = PostgresStoreFactory(session);
this.store = new PostgresStore({
  pool: pgPool,
  createTableIfMissing: true,
  errorLog: (...args) => {
    logger.error('Postgres session backend error:', ...args);
  },
  pruneSessionInterval: false,
});

Normally I would expect that the session table can be automatically created since I specified createTableIfMissing=true, but in fact it's not.

Error: relation "session" does not exist

Removing pruneSessionInterval=false fixes it, but I think these two parameters should not have dependency on each other, so this looks like a bug to me.

@voxpelli
Copy link
Owner

voxpelli commented Jun 7, 2023

This is odd, as all the integration tests for the auto-creation of tables are run with pruneSessionInterval: false, see

pruneSessionInterval: false,

Are you sure pruneSessionInterval: false is the cause? I typically go about fixing a bug like this by creating a test case that reproduces the failure and then fixing the code until that test case passes, but in this case there are already test cases that shows that this should be working

@Reiddd
Copy link
Author

Reiddd commented Jun 7, 2023

I'm pretty sure, but your test case looks more persuasive x_x
Anyway, in my product we have bypassed this issue, so I'm ok if you want to close this.
I will keep an eye on this kind of issue in my product to look for the real root cause if there is one

@voxpelli
Copy link
Owner

voxpelli commented Jun 7, 2023

Sorry, didn't see your comment before I added the label 🙈 Closing for now then, open a new one if the issue pops up again

@voxpelli voxpelli closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants