bnoguchi/mongoose-auth

Error with everyauth after 0.3 version update

nleush opened this issue · 8 comments

TypeError: Object # has no method 'User'
at module.exports.findUserById (/node_modules/mongoose-auth/lib/modules/everymodule/everyauth.js:7:10)

Temporary fix available with package.json:

"dependencies": {
"mongoose-auth": "git://github.com/nleush/mongoose-auth.git",
}

Same problem in my case:

Error detected: TypeError: Object #<Object> has no method 'User'
TypeError: Object #<Object> has no method 'User'
    at module.exports.findUserById (/node_modules/mongoose-auth/lib/modules/everymodule/everyauth.js:7:10)
    at Object.fetchUserFromSession [as handle] (/node_modules/mongoose-auth/node_modules/everyauth/index.js:52:13)
    at next (/node_modules/mongoose-auth/node_modules/everyauth/node_modules/connect/lib/http.js:204:15)
    at Object.registerReqGettersAndMethods [as handle] (/node_modules/mongoose-auth/node_modules/everyauth/index.js:28:9)
    at next (/node_modules/mongoose-auth/node_modules/everyauth/node_modules/connect/lib/http.js:204:15)
    at HTTPServer.Server.handle (/node_modules/mongoose-auth/node_modules/everyauth/node_modules/connect/lib/http.js:217:3)
    at Object.Server.use.handle (/node_modules/express/node_modules/connect/lib/http.js:106:14)
    at next (/node_modules/express/node_modules/connect/lib/http.js:204:15)
    at exports.send (/node_modules/express/node_modules/connect/lib/middleware/static.js:150:11)
    at Object.oncomplete (fs.js:297:15)

Same here.

same here @nleush i tried your package.json hack, and indeed it resolved it temporarily, but it causes an unmet dependency error when i run npm shrinkwrap.

I was able to resolve it by forcing an upgrade to mongoose 3.x all around. I also forked mongoose-auth here: https://github.com/davisford/mongoose-auth and I forced it to mongoose 3.x. In my project, I also depend on mongoose, so I forced that to 3.x and all seems to be working again. Here's the commit on my project -- you can inspect the complete npm-shrinkwrap to see if it helps resolve your deps. davisford/daisycentral@053be0b

In my case the problem's cause was in Everyauth - see Issue 322, where the new Express autodetection functionality is put to blame.

I've submitted pull request 323 to revert this functionality since it seems to be inherently broken to me.

Is there any recent news on this issue?

In my case, we've migrated to PassportJS since:

  1. everyauth and mongoose-auth seem to not be maintained anymore,
  2. some design decisions in everyauth seriously violate programming best practices - the code is tied too closely with particular versions of Express, see Everyauth issue 322.

there seems to be some activity 20 days ago: https://github.com/bnoguchi/everyauth/tree/express3.
@bnoguchi is there any news on this?

@aadamowski Is there a comparable persistence module for Passport?

AFAIR we've implemented a custom module analogous to Mongoose-auth. It wasn't exactly rocket science.