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

Mistake in PostGreSQL example? #110

Open
alandsidel opened this issue Jul 17, 2024 · 0 comments
Open

Mistake in PostGreSQL example? #110

alandsidel opened this issue Jul 17, 2024 · 0 comments

Comments

@alandsidel
Copy link

This code is adapted from the example at https://github.com/gx0r/connect-session-knex/blob/main/examples/example-postgres.mjs but results inthe error Cannot find module 'sqlite3' in node_modules/connect-session-knex/dist/index.js:26:36

'use strict';

import pg from 'pg';
import knex from 'knex';
import { ConnectSessionKnexStore } from 'connect-session-knex';
import consts from './consts.cjs';

const db = knex({
  client: 'pg',
  connection: {
    host: consts.DB_HOST,
    port: consts.DB_PORT,
    user: consts.DB_USER,
    password: consts.DB_PASS,
    database: consts.DB_DB
  },
  searchPath: consts.DB_SCHEMA
});

const sessionStore = new ConnectSessionKnexStore({
  db,
  tablename: 'sessions'
});

It appears that this is because ConnectSessionKnexStore needs the knex instance to be in a key named knex, not simply on it's own as above in the sessionStore var, and changing db, to knex: db, does appear to solve the issue. Is this just a mistake in the example that needs corrected?

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