Sailsjs session error

Keep getting this warning and error when I bring up the application and cannot figure it out. Hoping someone has an idea about this:

warn: Socket is disabled, but the session can not be loaded to go to the configured handler separation: sails.config.sockets.onDisconnect(). A fake empty session will pass as an argument to the lifecycle callback. Details: Error: The session could not be loaded into _createError (/Users/JAT/Dropbox/Bottage/bottage_app/node_modules/sails/lib/hooks/session/index.js:271:21) on Immediate._onImmediate (/ Users / JAT /Dropbox/Bottage/bottage_app/node_modules/sails/lib/hooks/session/index.js:274:13) on processImmediate [as _immediateCallback] (timers.js: 358: 17) {[Error: Session could not be loaded] code: 'E_SESSION'}


wZVanG Edit : the problem has already been fixed, however I am wondering if I have the correct configuration:

sailsrc (I removed the models from the Sailsdefault ones because I just use them mongoose), but socketsI didn’t have to delete them:

"hooks": {"orm": false, "pubsub": false, "blueprints": false}

/config/sessions.js

adapter: 'mongo',
host: 'localhost',
port: 27017,
db: 'page',
collection: 'sessions',

Saves it to my Mongo database:

{
    "_id" : "Nt90RxTcHkOT9aM3qJ1QzxyHlnvFoUuw",
    "session" : "{\"cookie\":{\"originalMaxAge\":null,\"expires\":null,\"httpOnly\":true,\"path\":\"/\"},\"passport\":{}}",
    "expires" : ISODate("2015-07-24T10:59:42.551Z")
}

It is right?

+4
source share
1 answer

The reason for the message is that when you restart the sails, the session information is deleted on the server side, but the session cookie is still on the client side, and when it reconnects, it reuses the previous session cookie to determine which is no longer valid and therefore The server logs this warning.

There are several ways to prevent this message:

.sails.rc:

  {
    "hooks": {
      "sockets": false,
      "pubsub": false 
     }
  }
  1. ,
+1

All Articles