Skip to content
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

a promise was created in a handler but was not returned from it #1

Open
wjzwjh opened this issue May 26, 2016 · 0 comments
Open

a promise was created in a handler but was not returned from it #1

wjzwjh opened this issue May 26, 2016 · 0 comments

Comments

@wjzwjh
Copy link
Contributor

wjzwjh commented May 26, 2016

In the following code , server pop up warning:a promise was created in a handler but was not returned from it

export function changeTheme(req, res, next) {
var userId = req.user._id;
var theme = String(req.body.theme);
return User.find({
where: {
_id: userId
}
})
.then(user => {
user.theme = theme;
return user.save()
.then(() => {
res.status(204).end();
})
.catch(validationError(res));
});
}

Here is stack Trace:

PUT /api/users/155/theme 200 208.007 ms - 15
Warning: a promise was created in a handler but was not returned from it
at processImmediate as _immediateCallback
From previous event:
at [object Object].Model.findAll (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\sequelize\lib\model.js:1347:18)
at [object Object].Model.findOne (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\sequelize\lib\model.js:1519:34)
at localAuthenticate (passport.js:5:8)
at Strategy._verify (passport.js:35:12)
at Strategy.authenticate (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\passport-local\lib\strategy.js:90:12)
at attempt (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\passport\lib\middleware\authenticate.js:348:16)
at authenticate (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\passport\lib\middleware\authenticate.js:349:7)
at index.js:10:3
at Layer.handle as handle_request
at next (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\route.js:131:13)
at Route.dispatch (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\route.js:112:3)
at Layer.handle as handle_request
at H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:277:22
at Function.process_params (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:330:12)
at next (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:271:10)
at Function.handle (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:176:3)
at router (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:46:12)
From previous event:
at Promise.then (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\sequelize\lib\promise.js:21:17)
at E4Store.get (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express-sequelize-session\lib\e4store.js:56:12)
at session (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express-session\index.js:403:11)
at Layer.handle as handle_request
at trim_prefix (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:312:13)
at H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:280:7
at Function.process_params (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:330:12)
at next (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:271:10)
at initialize (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\passport\lib\middleware\initialize.js:53:5)
at Layer.handle as handle_request
at trim_prefix (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:312:13)
at H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:280:7
at Function.process_params (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:330:12)
at next (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:271:10)
at cookieParser (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\cookie-parser\index.js:70:5)
at Layer.handle as handle_request
at trim_prefix (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:312:13)
at H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:280:7
at Function.process_params (H:\nginx-1.9.14\html\bootswatchMenu2\node_modules\express\lib\router\index.js:330:12)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant