node-connect-pg-simple: createTableIfMissing not working
With the following
import connectPgSimple from 'connect-pg-simple';
const store = new (connectPgSimple(session))({createTableIfMissing: true} as any);
app.use(session({secret: '...', saveUninitialized: true, resave: false, store})); // defaults: httpOnly
I just get Failed to prune sessions: relation "session" does not exist on start and error: relation "session" does not exist on the first request.
Also, without as any I get Argument of type '{ createTableIfMissing: boolean; }' is not assignable to parameter of type 'PGStoreOptions'., so @types/connect-pg-simple seems to be outdated.
"@types/connect-pg-simple": "^4.2.2",
"connect-pg-simple": "^6.2.1",
"express": "^4.17.1",
"express-session": "^1.17.1",
"typescript": "^4.1.5",
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 17 (5 by maintainers)
I corrected myself earlier:
Part of the reason is that this has to interact with express-session and for a long time those types were a bit so-so, making it hard to make something useful of it.
Apart from that: The focus of this module is to be the simplest postgres session module for express, thus depending on nothing but the pg module itself, enabling it to be used for most scenarios.
If one needs a more complex solution, then it’s correct to look for that in another solution.
If one believes this module fails in delivering what it intends to deliver, then let’s fix it 🙂
Thanks @aboqasem, I had forgotten that
7.0.0was still in a prerelease state, I have now released a stable7.0.0.Sorry everyone for not thinking of this myself earlier. I’ll close this issue as solved for now, if an update to
7.0.0does not solve it, then comment and I can reopen.Well said 🙂 I want to heavily emphasize I am not implying anything negative about the work - it is once again, excellent. I would try to fix the mentioned issues myself, I just don’t have the time either right now. 😆
The
@types/connect-pg-simpleshould not be used,connect-pg-simplecomes with its own types, I should look into getting that one deprecated.Regarding main issue: I’ll give it a look