-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Socket.io : Could not load session for socket #....... #2263
Comments
Ok the issue is a conflict of cookies => I've been using http://luisfarzati.github.io/angulartics/ to install Google Analytics with my angularjs application. For each request / call to my Sails js API, the cookie sent with the socket and the one sent by angulartics (for google analytics) somehow "come in conflict" and my SailsJS server prints this error. Is there any workaround for this issue? |
After some testing on my side, I could reproduce exactly the issue doing the following steps and the bug appears on one condition:
Conflict appears to be with Google analytics cookies and Sails socket cookie |
Very weird behavior (if has to do with analytics) Can a core dev give us any insights? |
The problem is clearly addressed in this (thread)[http://stackoverflow.com/questions/21106983/unable-to-get-session-for-socket-in-sailsjs-after-restart]. This feature could be implemented in sailsSocket with a failover. |
To workaround the browser/socket/cookie problem just call the backend with an ajax call
But I have no idea of how to detect the problem and automate the workaround for socket-only apps |
thiagof: I'm using $sailsSocket and not ajax calls mhhh. However, this issue also appears with other websites cookie stored. |
The ajax call is to restore your session with the backend, cause 2014-11-29 20:46 GMT-02:00, billyshena notifications@github.com:
Thiago Fernandes |
Mhh so no real fixes at moment then. Looks like other sails user do not have this issue |
👍 |
+1 |
Did anyone find out a solution or any fix? |
+1 |
1 similar comment
+1 |
Have you tried to enable session storage? 2015-02-17 19:13 GMT-02:00 GeoCloud notifications@github.com:
Thiago Fernandes |
I'm getting the same thing. I overwrote my socket.js I'm wondering is there a way to turn off sessions in general (I'm using JWT). I've disabled the cookieParser middleware, but now want to also disable all sessions in generale. |
Sorry for the slow response guys. @JetFault re: disabling session- you can do so by disabling the session hook. As of Sails 0.11, the sockets hook should fully support session-free usage. @stenstrud @RobiFerentz @svnh @billyshena have you been able to reproduce this in Sails v0.11 w/ the new sockets hook? |
Hi @mikermcneil |
Best solution to me were using a database session adapter 2015-04-27 11:09 GMT-03:00 mackenrou notifications@github.com:
Thiago Fernandes |
Thanks for posting, @billyshena. I'm a repo bot-- nice to meet you! It has been 60 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message. On the other hand, if you are still waiting on a patch, please:
Thanks so much for your help! |
Hello everyone. I've been working with sails 0.10.2 version and sometimes when I quit my browser and restart it to hit my app url , I get an error like this:
error: Could not load session for socket #F4O-lvWICcs6uQTYREOc
error: The socket's cookie could not be parsed into a sessionID.
error: Unless you're overriding the
authorization
function, make sure you pass in a validsails.sid
cookieerror: (or omit the cookie altogether to have a new session created and an encrypted cookie sent in the response header to your socket.io upgrade request)
error: TypeError: Cannot call method 'indexOf' of undefined
at exports.parseSignedCookie (/Users/bshen/Desktop/educloud-v20/backend/node_modules/sails/node_modules/express/node_modules/connect/lib/utils.js:199:19)
at Object.Session.fromSocket (/Users/bshen/Desktop/educloud-v20/backend/node_modules/sails/lib/hooks/session/index.js:339:38)
at interpretSocketReq (/Users/bshen/Desktop/educloud-v20/backend/node_modules/sails/lib/hooks/sockets/lib/interpreter/interpret.js:542:19)
at Socket. (/Users/bshen/Desktop/educloud-v20/backend/node_modules/sails/lib/hooks/sockets/lib/connection.js:95:5)
at Socket.emit as $emit
at SocketNamespace.handlePacket (/Users/bshen/Desktop/educloud-v20/backend/node_modules/sails/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Users/bshen/Desktop/educloud-v20/backend/node_modules/sails/node_modules/socket.io/lib/manager.js:518:38)
at WebSocket.Transport.onMessage (/Users/bshen/Desktop/educloud-v20/backend/node_modules/sails/node_modules/socket.io/lib/transport.js:369:20)
at Parser. (/Users/bshen/Desktop/educloud-v20/backend/node_modules/sails/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)
at Parser.emit (events.js:95:17) [TypeError: Cannot call method 'indexOf' of undefined]
I've tried to debug but can't figure out what's wrong. Any kind of request to my Sails API launches this error and I have to make a refresh/F5 on my browser to make it work again.
Does anyone have an idea?
Regards,
The text was updated successfully, but these errors were encountered: