trailsjs / sails-permissions

Comprehensive user permissions and entitlements system for sails.js and Waterline. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.
MIT License
418 stars 113 forks source link

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

Open dottodot opened 8 years ago

dottodot commented 8 years ago

On sails 0.12.0 I'm getting the warning

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

which I believe is due to the policies Promises needing a return. Here's the issues I orginally posted on sails https://github.com/balderdashy/sails/issues/3556

khchan commented 8 years ago

+1 I'm getting the same warnings in my controllers.

wfpaisa commented 8 years ago
Warning: a promise was created in a handler but was not returned from it
    at wrapper (/Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/lodash/index.js:3592:19)
    at applyInOriginalCtx (/Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:417:80)
    at wrappedCallback (/Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:320:18)
    at callback.success (/Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/normalize.js:33:31)
    at _switch (/Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/factory.js:58:28)
    at /Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/update.js:234:9
    at /Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:52:16
From previous event:
    at Deferred.toPromise (/Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/deferred.js:494:61)
    at Deferred.then (/Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/deferred.js:505:15)
    at attachDefaultRole (/Users/pepito/Sites/sailsjs/permissions2/node_modules/sails-permissions/dist/api/models/User.js:33:45)
    at fn (/Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/callbacksRunner.js:60:10)
    at /Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:181:20
    at iterate (/Users/pepito/.nvm/versions/node/v4.4.0/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:262:13)
quantjin commented 8 years ago

I'm also getting this warning with sails 0.12.1

lakinoheat commented 8 years ago

Is this issue still not fixed? Am also having this same warning.

giano commented 8 years ago

Same on Sails 0.12.3

medisoft commented 7 years ago

Same as me

Warning: a promise was created in a handler but was not returned from it
    at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
    at Deferred.toPromise (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/waterline/lib/waterline/query/deferred.js:494:61)
    at Deferred.then (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/waterline/lib/waterline/query/deferred.js:505:15)
    at Object.module.exports.load (/home/mario/IdeaProjects/IG/scorecard/backend/api/controllers/TestItemController.js:18:8)
    at wrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/lodash/lib/index.js:3250:19)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:135:11)
    at pass (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:145:5)
    at nextRoute (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:100:7)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:167:11)
    at module.exports (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-permissions/dist/api/policies/CriteriaPolicy.js:53:12)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:135:11)
    at pass (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:145:5)
    at nextRoute (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:100:7)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:167:11)
    at module.exports (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-permissions/dist/api/policies/RolePolicy.js:26:12)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:135:11)
    at pass (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:145:5)
    at nextRoute (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:100:7)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:167:11)
    at /home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-permissions/dist/api/policies/PermissionPolicy.js:43:5
From previous event:
    at module.exports (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-permissions/dist/api/policies/PermissionPolicy.js:34:51)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:135:11)
    at pass (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:145:5)
    at nextRoute (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:100:7)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:167:11)
    at OwnerPolicy (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-permissions/dist/api/policies/OwnerPolicy.js:33:3)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:135:11)
    at pass (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:145:5)
    at nextRoute (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:100:7)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:167:11)
    at module.exports (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-permissions/dist/api/policies/AuditPolicy.js:22:3)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:135:11)
    at pass (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:145:5)
    at nextRoute (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:100:7)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:167:11)
    at ModelPolicy (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-permissions/dist/api/policies/ModelPolicy.js:28:12)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:135:11)
From previous event:
    at Deferred.then (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/waterline/lib/waterline/query/deferred.js:505:27)
    at /home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/dist/api/services/passport.js:327:40
    at pass (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/node_modules/passport/lib/authenticator.js:347:9)
    at Authenticator.deserializeUser (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/node_modules/passport/lib/authenticator.js:352:5)
    at SessionStrategy.authenticate (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/node_modules/passport/lib/strategies/session.js:53:28)
    at attempt (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/node_modules/passport/lib/middleware/authenticate.js:348:16)
    at authenticate (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/node_modules/passport/lib/middleware/authenticate.js:349:7)
    at /home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/dist/api/policies/passport.js:37:23
    at initialize (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/node_modules/passport/lib/middleware/initialize.js:53:5)
    at module.exports (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/dist/api/policies/passport.js:35:24)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:135:11)
    at pass (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:145:5)
    at nextRoute (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:100:7)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:167:11)
    at module.exports (/home/mario/IdeaProjects/IG/scorecard/backend/node_modules/sails-auth/dist/api/policies/basicAuth.js:13:12)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:135:11)
    at pass (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:145:5)
    at nextRoute (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:100:7)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:167:11)
    at module.exports (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/hooks/cors/clear-headers.js:14:3)
    at routeTargetFnWrapper (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/lib/router/bind.js:181:5)
    at callbacks (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:164:37)
    at param (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:138:11)
    at pass (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:145:5)
    at nextRoute (/home/mario/.nvm/versions/node/v5.8.0/lib/node_modules/sails/node_modules/@sailshq/express/lib/router/index.js:100:7)