error: relation "session" does not exist
See original GitHub issueAfter installing connect-pg-simple
in my Drywall app, pg
is complaining as such:
error: relation "session" does not exist
I’ve created the session
table in the same database as the rest of my application uses, but I still get the above exception. I’ve also tried to specify the conString
property, as such:
app.use(session({
resave: true,
saveUninitialized: true,
secret: config.cryptoKey,
store: new (require('connect-pg-simple')(session))(),
cookie: { maxAge: 30 * 24 * 60 * 60 * 1000 }, // 30 days
conString: 'pg://' + config.username + ':' + config.password + '@' + config.host + '/' + config.database
}));
But it doesn’t help. Ideas?
Issue Analytics
- State:
- Created 8 years ago
- Comments:19 (6 by maintainers)
Top Results From Across the Web
Connect-pg-simple express: Failed to prune sessions
Anyways, I am getting this error and I couldn't find a solution: (Failed to prune sessions: relation "session" does not exist) P.S: I ......
Read more >ERROR: relation "session" does not exist - PokerTracker
If the "session" table is missing then it sounds like the database is corrupted. Look at the database using pgAdmin. Do you see...
Read more >"Net_1762 ERROR: Relation does not exist" when running a ...
When creating the table on NPS, the table name was created without using double quotes, which can cause this issue. Solution.
Read more >Postgres : Relation does not exist error
But when I try to fire a select * query, it gave me this error: dump=> select * from Approvals; ERROR: relation "approvals"...
Read more >Sporadic StatementInvalid: relation "sessions" does not exist
So somehow your sessions table is getting deleted, a database handle is pointed to the wrong database or schema, or something is connecting...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A note is included in the documentation that says it is necessary to create the session table yourself:
Though it is easy to overlook. I did at first 😃
You can either manually generate the table by executing it via
psql
:Or you can create the table before creating your instance of
pgSession
. Here’s an example using knex:The
conString
should be sent intonew (require('connect-pg-simple')(session))()
like: