saltyshiomix / ark

An easiest authentication system on top of NestJS, TypeORM, NEXT.js(v9.3) and Material UI(v4).
MIT License
259 stars 17 forks source link

Failed to prune sessions: read ECONNRESET #9

Closed pirmax closed 5 years ago

pirmax commented 5 years ago

Hi,

I tried to install MongoDB instead PG. I've this warning after NestJS logs:

Failed to prune sessions: read ECONNRESET

I don't know why...

iamsteeve commented 5 years ago

Will you use TypeORM or Mongoose? If you are trying to change typeorm you must take into account that the user session middleware is coupled to postgresql specifically the connect-pg-simple package you should look for a similar middleware in mongo, you can also have both databases mounted, without replacing the models of user and use another connection or other ORM for information only. in the main file you can see that middleware


  // production ready session store
  const pgSession = require('connect-pg-simple')(session);
  server.use(session({
    secret: process.env.SESSION_SECRET as string,
    store: new pgSession({
      conString: `postgres://${process.env.DB_USERNAME}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_DATABASE}`,
      crear_interval: 60 * 60 // sec
    }),
    resave: false,
    saveUninitialized: false,
    rolling: true,
    cookie: {
      httpOnly: false,
      maxAge: 60 * 60 * 1000 // msec
    }
  }));
saltyshiomix commented 5 years ago

I updated some codes today 👍

@pirmax Still the error happen?

saltyshiomix commented 5 years ago

ARK is an example of PostgreSQL, so I closed this issue.