michaelkrone / generator-material-app

Yet another yeoman generator for scaffolding a simple Node.js/Express/MongoDB/Angular.js app using some material design elements.
MIT License
177 stars 48 forks source link

acl.user not found #100

Open victorcechinel opened 7 years ago

victorcechinel commented 7 years ago

jsonwebtoken: expiresInMinutes and expiresInSeconds is deprecated. (/Users/victorcechinel/projetos/brcasp/app/server/lib/auth/auth.service.js:131:14) Use "expiresIn" expressed in seconds. POST /auth/local 200 34ms - 204b defaultErrorHandler /api/users/me 200 [Error: No active context found to set property request:acl.user] Error: No active context found to set property request:acl.user at Object.setContext (/Users/victorcechinel/projetos/brcasp/app/node_modules/request-context/lib/index.js:85:9) at addAuthContextMiddleWare (/Users/victorcechinel/projetos/brcasp/app/server/lib/auth/auth.service.js:164:20) at Layer.handle [as handle_request] (/Users/victorcechinel/projetos/brcasp/app/node_modules/express/lib/router/layer.js:82:5) at next (/Users/victorcechinel/projetos/brcasp/app/node_modules/express/lib/router/route.js:100:13) at next (/Users/victorcechinel/projetos/brcasp/app/node_modules/composable-middleware/lib/composable-middleware.js:40:9) at /Users/victorcechinel/projetos/brcasp/app/server/lib/auth/auth.service.js:98:9 at Query.<anonymous> (/Users/victorcechinel/projetos/brcasp/app/node_modules/mongoose/lib/model.js:3340:16) at /Users/victorcechinel/projetos/brcasp/app/node_modules/kareem/index.js:259:21 at /Users/victorcechinel/projetos/brcasp/app/node_modules/kareem/index.js:127:16 at nextTickCallbackWith0Args (node.js:419:9) at process._tickDomainCallback (node.js:389:13) GET /api/users/me 500 7ms

Login error

spaceghostu commented 7 years ago

+1

Stupidism commented 7 years ago

This repo wasn't finished(Notice the under heavy development) and didn't get any contributions for a long time. This generator isn't used very much in my team, so I don't have the passion to complete this repo. The author seems busy, too.

Recommendations:

  1. Find another generator/start-kit.
  2. Try node 4, npm 3.
  3. Try develop branch. If it works, fork this repo and maintain it yourselves. If not, try recommendation 1.
tenchugecko commented 7 years ago

is there any help on this, another project using request-context, router and passport? what did change so hard in mongoose update's Why does the active context not initialize anymore?

i'm on this right now, and went through all of the code twice now.

michaelkrone commented 7 years ago

Hi @tenchugecko,

I'am sorry you are facing problems with the generated code. This project has not seen any activity a long time, since I am very busy at the moment. I am willing to accept any pull requests or contributors, but since there are many better thought and much better supported AngularJS and Angular(2) generators out there, in all flavours and sizes, maybe you might port your code to those. I definitely should add a deprecation warning on the README. Sorry again.

Just to keep you motivated, I know it is possible to run request-context, router and passport, even if it does not help you much. Maybe you hit https://github.com/michaelkrone/request-context/issues/17 Try request-context in a version below 1.0.0!

tenchugecko commented 7 years ago

This thing broke when i updated mongoose from 4.2.6 to 4.7.6 the global bluebird promise didnt change anything :(

michaelkrone commented 7 years ago

Die you try setting mongoose.promise = require ('bluebird')?

tenchugecko commented 7 years ago

forked and updated all of my project -) jwt expireInMinutes => change to: expiresIn -) Cannot read property 'model' of undefined in the controllers (this.model) =>seems like prototyping class stuff. -) mongoose.promise didnt help on the context, when used in the model. didnt find the "global way" yet -) mongoose populate doesnt work correctly

time will solve this. :)

tenchugecko commented 7 years ago

pleas give me a hint if you can: why is "this" not avaiable in the .prototype

defaultErrorHandler /api/users 200 TypeError: Cannot read property 'omit' of undefined at index (G:_soundsets_projects\SoundSetsWebAdmin\sswa_updated\server\lib\controllers\crud.controller.js:101:11) ......

tenchugecko commented 7 years ago

so i need to bind things: got the user route to work again http://stackoverflow.com/questions/34680450/this-is-undefined-in-expressjs-route-handler server/api/user/index.js:

router.route('/').get(isAdmin, controller.index.bind(controller))

and in the controller class constructors somewhere this.index = this.index.bind(this);