Description
Node version: 16.6.0
Sails version (sails): 1.5.7
ORM hook version (sails-hook-orm): latest
Sockets hook version (sails-hook-sockets): latest
Organics hook version (sails-hook-organics): Unknown
Grunt hook version (sails-hook-grunt): latest
Uploads hook version (sails-hook-uploads): Unknown
DB adapter & version (e.g. sails-mysql@5.55.5): sails-mysql latest
Skipper adapter & version (e.g. skipper-s3@5.55.5): none
Session store: memorystore (also tested flat-file-store)
Commit 4a023dc breaks websocket sessions. Namely, req.session is undefined even when a cookie exists in the handshake. Reverting this commit / changes to the req file fixes the problem.
Before knowing the cause of the issue, I attempted a bandage fix by creating a hook to restore req.session if it was undefined. But this did not work; sailsJS was thinking every single API call was a new client, and thus sessions were not persisting / every request had a new session.
Next, I checked cookie parsing. It was correctly receiving the cookie string, but console was outputting an empty object for the cookies. I thought this was weird and thought this was the problem as well. But I looked at the code and saw no reason for it to not work. So I moved on.
I investigated the latest changes, and that's when I noticed the change in virtual req parsing. Since sessions were stored in the req, I decided to see what would happen if I reverted that file to 1.5.6's version. Sure enough, sessions started working again.
Activity