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.

createTableIfMissing not working

See original GitHub issue

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",

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
voxpellicommented, Jul 21, 2021

I don’t see its types declared anywhere? How are you using its types? (Looking at it, tsconfig points to index.js, and there is lots of annotations)

I corrected myself earlier:

Sorry, I misspoke earlier, this is the one of my modules that actually doesn’t yet generate its own types, see #155

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 🙂

1reaction
voxpellicommented, Sep 6, 2021

Thanks @aboqasem, I had forgotten that 7.0.0 was still in a prerelease state, I have now released a stable 7.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.0 does not solve it, then comment and I can reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

voxpelli/node-connect-pg-simple - GitHub
Advanced example showing some custom options: ... createTableIfMissing - if set to true then creates the table in the case where the table...
Read more >
Connect-pg-simple express: Failed to prune sessions
Reason: You are having that error because you probably do not have the session table in your database. Probably fix:.
Read more >
connect-pg-simple - npm Package Health Analysis - Snyk
The npm package connect-pg-simple was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >
Problem In writing data in SQL Sever 2008 - Qlik Community
Hello,. I hav created a excel schema and table schema. To read data from excel and write that data into database table.
Read more >
CSV File to SQL - Confluence
Param Name Is Required Inputs Type Input Default Value sourceFilePath True String delimiter False String ',' encoding False String UTF‑8
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