express-mongoose-es6-rest-api
express-mongoose-es6-rest-api copied to clipboard
What could be the cause for this error?
Promise { _bitField: 0, _fulfillmentHandler0: undefined, _rejectionHandler0: undefined, _promise0: undefined, _receiver0: undefined, _trace: { Error at Promise.longStackTracesCaptureStackTrace [as _captureStackTrace] (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/bluebird/js/release/debuggability.js:396:19) at Promise._resolveFromExecutor (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/bluebird/js/release/promise.js:478:10) at new Promise (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/bluebird/js/release/promise.js:77:14) at model.Query.exec (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/mongoose/lib/query.js:2294:17) at Function.list (/Users/tharaka/Documents/Projects/eventfly/hyperloop/dist/server/models/user.model.js:85:29) at list (/Users/tharaka/Documents/Projects/eventfly/hyperloop/dist/server/controllers/user.controller.js:83:18) at Layer.handle [as handle_request] (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/layer.js:95:5) at next (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/route.js:131:13) at Route.dispatch (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/layer.js:95:5) at /Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:277:22 at Function.process_params (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:330:12) at next (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:271:10) at Function.handle (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:176:3) at router (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:46:12) at Layer.handle [as handle_request] (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:312:13) at /Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:280:7 at Function.process_params (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:330:12) at next (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:271:10) at Function.handle (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:176:3) at router (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:46:12) at Layer.handle [as handle_request] (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:312:13) at /Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:280:7 at Function.process_params (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:330:12) at next (/Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express/lib/router/index.js:271:10) at /Users/tharaka/Documents/Projects/eventfly/hyperloop/node_modules/express-winston/index.js:306:9 _parent: undefined, _promisesCreated: 0, _length: 1, _promiseCreated: null } }
@tharakabimal Is this complete log ? Not sure, but looks like it is either an unhandled promise rejection or you haven't defined success and error handler for a promise.
I'm new to NodeJS and express, so this could be a mistake from my end too. But here's the complete log.
https://gist.github.com/tharakabimal/7885aa2d5d1db4b4cf3af1b3b4e998b6
@tharakabimal Can you me the code changes that you made in HTTP GET /api/users ?
@KunalKapadia The only change I made to the original code is only on the user model. https://gist.github.com/tharakabimal/4947dbdaedc1f3b889bb42ab8c61d027#file-usermodel-js-L60