Closed
Description
I've been trying to solve this issue and trying very hard to look for similar problems. But there's only one person experiencing the same problem as me: https://groups.google.com/forum/#!searchin/sailsjs/connect-redis/sailsjs/J0w1O32SHkk/fprYyJYne5QJ
I have tested that if i had installed connect-redis@1.5.0 locally, I can't sails lift. If I had changed to connect-redis@1.4.5 instead, I am able to lift it. Of course, I npm install connect-redis@1.4.5 --save but when I pushed to heroku it throws me the same error I would received as though I had installed the v1.5.0.
Nov 07 08:54:38 sails-wusrs heroku/slug-compiler: Slug compilation started
Nov 07 08:54:50 sails-wusrs heroku/slug-compiler: Slug compilation finished
Nov 07 08:54:50 sails-wusrs heroku/web.1: State changed from crashed to starting
Nov 07 08:54:55 sails-wusrs heroku/web.1: Starting process with command `NODE_ENV=production node app.js`
Nov 07 08:54:58 sails-wusrs app/web.1: Could not load Connect session adapter :: connect-redis
Nov 07 08:54:58 sails-wusrs app/web.1: A hook (`session`) failed to load!
Nov 07 08:54:58 sails-wusrs app/web.1: Error from adapter:
Nov 07 08:54:58 sails-wusrs app/web.1: TypeError: Cannot read property 'prototype' of undefined
Nov 07 08:54:58 sails-wusrs app/web.1: at module.exports (/app/node_modules/connect-redis/lib/connect-redis.js:96:41)
Nov 07 08:54:58 sails-wusrs app/web.1: at Hook.Session.initialize (/app/node_modules/sails/lib/hooks/session/index.js:204:33)
Nov 07 08:54:58 sails-wusrs app/web.1: at Hook.bound [as initialize] (/app/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
Nov 07 08:54:58 sails-wusrs app/web.1: at /app/node_modules/sails/lib/hooks/index.js:132:16
Nov 07 08:54:58 sails-wusrs app/web.1: at /app/node_modules/sails/node_modules/async/lib/async.js:425:17
Nov 07 08:54:58 sails-wusrs app/web.1: at /app/node_modules/sails/node_modules/async/lib/async.js:419:17
Nov 07 08:54:58 sails-wusrs app/web.1: at Array.forEach (native)
Nov 07 08:54:58 sails-wusrs app/web.1: at _each (/app/node_modules/sails/node_modules/async/lib/async.js:32:24)
Nov 07 08:54:58 sails-wusrs app/web.1: at Object.taskComplete (/app/node_modules/sails/node_modules/async/lib/async.js:418:13)
Nov 07 08:54:58 sails-wusrs app/web.1: at processImmediate [as _immediateCallback] (timers.js:345:15)
Nov 07 08:54:58 sails-wusrs app/web.1: Do you have the Connect session adapter installed in this project?
Nov 07 08:54:58 sails-wusrs app/web.1: Try running the following command in your project's root directory:
Nov 07 08:54:58 sails-wusrs app/web.1: npm install connect-redis@1.4.5
Nov 07 08:54:58 sails-wusrs app/web.1: (Note that `connect-redis@1.5.0` introduced breaking changes- make sure you have v1.4.5 installed!)
Nov 07 08:54:58 sails-wusrs app/web.1: Could not load Connect session adapter :: connect-redis
Nov 07 08:54:58 sails-wusrs app/web.1: Error from adapter:
Nov 07 08:54:58 sails-wusrs app/web.1: TypeError: Cannot read property 'prototype' of undefined
Nov 07 08:54:58 sails-wusrs app/web.1: at module.exports (/app/node_modules/connect-redis/lib/connect-redis.js:96:41)
Nov 07 08:54:58 sails-wusrs app/web.1: at Hook.Session.initialize (/app/node_modules/sails/lib/hooks/session/index.js:204:33)
Nov 07 08:54:58 sails-wusrs app/web.1: at Hook.bound [as initialize] (/app/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
Nov 07 08:54:58 sails-wusrs app/web.1: at /app/node_modules/sails/lib/hooks/index.js:132:16
Nov 07 08:54:58 sails-wusrs app/web.1: at /app/node_modules/sails/node_modules/async/lib/async.js:425:17
Nov 07 08:54:58 sails-wusrs app/web.1: at /app/node_modules/sails/node_modules/async/lib/async.js:419:17
Nov 07 08:54:58 sails-wusrs app/web.1: at Array.forEach (native)
Nov 07 08:54:58 sails-wusrs app/web.1: at _each (/app/node_modules/sails/node_modules/async/lib/async.js:32:24)
Nov 07 08:54:58 sails-wusrs app/web.1: at Object.taskComplete (/app/node_modules/sails/node_modules/async/lib/async.js:418:13)
Nov 07 08:54:58 sails-wusrs app/web.1: at processImmediate [as _immediateCallback] (timers.js:345:15)
Nov 07 08:54:58 sails-wusrs app/web.1: Do you have the Connect session adapter installed in this project?
Nov 07 08:54:58 sails-wusrs app/web.1: Try running the following command in your project's root directory:
Nov 07 08:54:58 sails-wusrs app/web.1: npm install connect-redis@1.4.5
Nov 07 08:54:58 sails-wusrs app/web.1: (Note that `connect-redis@1.5.0` introduced breaking changes- make sure you have v1.4.5 installed!)
Nov 07 08:55:55 sails-wusrs heroku/web.1: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
Nov 07 08:55:55 sails-wusrs heroku/web.1: Stopping process with SIGKILL
Nov 07 08:55:56 sails-wusrs heroku/web.1: State changed from starting to crashed
I can't understand why is this happening. ): Is this something to do with heroku or sailsjs? Please help me. I'm quite desperate.
Activity
holyxiaoxin commentedon Nov 9, 2014
This issue is resolved by removing the ^ inside "^1.4.5". instead it'll look like this: "1.4.5"
sailsjs does not work with connect-redis@1.5.0 and strictly needs only @1.4.5 and below. upgrading the package will cause heroku to crash. removing ^ means that it'll only use version 1.4.5.
zacharygcook commentedon Jul 8, 2015
Thanks this helped me out a ton!
jury89 commentedon Feb 4, 2016
thank, you saved my day 👍
dspencerr commentedon Feb 6, 2016
amazing that they still have done nothing with this. Thanks so much!
mikermcneil commentedon Feb 9, 2016
We've spent quite a lot of time working on a better way to address this type of issue for dependencies you install in your app in general. Eventually for this particular case, I added a warning in the session hook that suggests changing the version of connect redis if an error occurs. But that was before the version of npm that generated carets instead of tildas from --save was widely used.
At the end of the day, the main issue here is with documentation. But I agree that more could still be done-- open to ideas.
Reopening this until we get the sails.config.session reference doc page and "scaling" conceptual doc page updated to specifically mention installing and pinning the 1.4.5 dependency.
sgress454 commentedon Feb 10, 2016
This should no longer be an issue with Sails v0.11.4+ and v0.12.x (that is, you should be able to use the newest connect-redis). The problem was that newer versions of connect-redis are initialized using
express-session
, while older ones simply useexpress
. We now support both.mikermcneil commentedon Feb 10, 2016
@dspencerr @jury89 would you guys try this out for us?
mikermcneil commentedon Feb 11, 2016
@dspencerr @jury89 @holyxiaoxin @djlovegrind Here's a preview of the updated docs that use
--save-exact
so that you end up with a pinned dependency in your app.Please open a new issue if you see any problems with this going forward. The relevant docs will be online sometime this week when we release the next patch for sails core. Thanks y'all!
tarunjadhwani commentedon Apr 14, 2016
Wait so should we downgrade connect-redis to 1.4.5? Because I'm using sails 0.12.1 and still facing this issue with connect-redis version 3.0.2?
sijojlouis commentedon May 8, 2016
+1
alexsalesdev commentedon Jun 21, 2017
+1
Fr33maan commentedon Oct 20, 2017
@mikermcneil @sgress454 broken when
connect-redis@3
, working when downgrading to1.4.5
.@sgress454 Does sails 0.12.x should support
connect-redis^3
?I've got another error: