{"action":"opened","issue":{"url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/719","labels_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/719/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/719/comments","events_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/719/events","html_url":"https://github.com/strongloop/loopback-datasource-juggler/issues/719","id":106813104,"number":719,"title":"Promises are broken","user":{"login":"esco","id":375773,"avatar_url":"https://avatars.githubusercontent.com/u/375773?v=3","gravatar_id":"","url":"https://api.github.com/users/esco","html_url":"https://github.com/esco","followers_url":"https://api.github.com/users/esco/followers","following_url":"https://api.github.com/users/esco/following{/other_user}","gists_url":"https://api.github.com/users/esco/gists{/gist_id}","starred_url":"https://api.github.com/users/esco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esco/subscriptions","organizations_url":"https://api.github.com/users/esco/orgs","repos_url":"https://api.github.com/users/esco/repos","events_url":"https://api.github.com/users/esco/events{/privacy}","received_events_url":"https://api.github.com/users/esco/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-16T16:45:02Z","updated_at":"2015-09-16T16:45:02Z","closed_at":null,"body":"My Loopback app is broken after a deploy that updated node_modules. Based on the error it seems like the issue is with `loopback-datasource-juggler`.\r\n\r\nRelevant dependencies\r\n``` json\r\n{\r\n    \"loopback-connector-mongodb\": \"^1.13.0\",\r\n    \"loopback-datasource-juggler\": \"^2.39.0\"\r\n}\r\n```\r\n\r\nTo replicate:\r\n\r\n```\r\n$ git clone https://github.com/senorcris/promise-failure\r\n$ npm i -g strongloop\r\n$ cd promise-failure\r\n$ npm i\r\n$ slc run\r\n```\r\n> https://github.com/senorcris/promise-failure made by @senorcris\r\n\r\nVisit http://127.0.0.1:3000/explorer/#!/People/test press the \"Try it out!\" button. You will get the following error:\r\n\r\n```\r\n{\r\n  \"error\": {\r\n    \"name\": \"TypeError\",\r\n    \"status\": 500,\r\n    \"message\": \"Cannot read property 'then' of undefined\",\r\n    \"stack\": \"TypeError: Cannot read property 'then' of undefined\\n    at Function.Person.test (/Volumes/Dev/servers/node/test/promise-failure/common/models/person.js:5:7)\\n    at SharedMethod.invoke (/Volumes/Dev/servers/node/test/promise-failure/node_modules/loopback/node_modules/strong-remoting/lib/shared-method.js:248:25)\\n    at HttpContext.invoke (/Volumes/Dev/servers/node/test/promise-failure/node_modules/loopback/node_modules/strong-remoting/lib/http-context.js:384:12)\\n    at /Volumes/Dev/servers/node/test/promise-failure/node_modules/loopback/node_modules/strong-remoting/lib/remote-objects.js:620:11\\n    at execStack (/Volumes/Dev/servers/node/test/promise-failure/node_modules/loopback/node_modules/strong-remoting/lib/remote-objects.js:460:7)\\n    at RemoteObjects.execHooks (/Volumes/Dev/servers/node/test/promise-failure/node_modules/loopback/node_modules/strong-remoting/lib/remote-objects.js:464:10)\\n    at /Volumes/Dev/servers/node/test/promise-failure/node_modules/loopback/node_modules/strong-remoting/lib/remote-objects.js:617:10\\n    at /Volumes/Dev/servers/node/test/promise-failure/node_modules/loopback/lib/application.js:357:13\\n    at /Volumes/Dev/servers/node/test/promise-failure/node_modules/loopback/lib/model.js:313:7\\n    at /Volumes/Dev/servers/node/test/promise-failure/node_modules/loopback/common/models/acl.js:465:23\"\r\n  }\r\n}\r\n```\r\n\r\nRemote method being called:\r\n```javascript\r\nPerson.test = function(cb) {\r\n    Person.find({\r\n      name: \"Jake\"\r\n    }).then(function(p) {\r\n      console.log('p: ', p);\r\n      cb(null, p);\r\n    }).catch(function(err) {\r\n      console.log(err);\r\n      cb(err);\r\n    });\r\n  };\r\n```\r\n\r\nPerson is a PersistedModel\r\n```json\r\n{\r\n  \"name\": \"Person\",\r\n  \"base\": \"PersistedModel\",\r\n  \"idInjection\": true,\r\n  \"options\": {\r\n    \"validateUpsert\": true\r\n  },\r\n  \"properties\": {\r\n    \"name\": {\r\n      \"type\": \"string\"\r\n    }\r\n  },\r\n  \"validations\": [],\r\n  \"relations\": {},\r\n  \"acls\": [],\r\n  \"methods\": {}\r\n}\r\n```\r\nPerson.find should return a promise, but instead returns `undefined`\r\n\r\nAny idea why PersistedModel.find isn't returning a promise?"}}