{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/951","repository_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler","labels_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/951/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/951/comments","events_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/951/events","html_url":"https://github.com/strongloop/loopback-datasource-juggler/issues/951","id":157777851,"number":951,"title":"Using an incorrect 'include' filter kill my loopback app.","user":{"login":"jgpacheco","id":8032466,"avatar_url":"https://avatars.githubusercontent.com/u/8032466?v=3","gravatar_id":"","url":"https://api.github.com/users/jgpacheco","html_url":"https://github.com/jgpacheco","followers_url":"https://api.github.com/users/jgpacheco/followers","following_url":"https://api.github.com/users/jgpacheco/following{/other_user}","gists_url":"https://api.github.com/users/jgpacheco/gists{/gist_id}","starred_url":"https://api.github.com/users/jgpacheco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgpacheco/subscriptions","organizations_url":"https://api.github.com/users/jgpacheco/orgs","repos_url":"https://api.github.com/users/jgpacheco/repos","events_url":"https://api.github.com/users/jgpacheco/events{/privacy}","received_events_url":"https://api.github.com/users/jgpacheco/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-31T21:44:44Z","updated_at":"2016-05-31T22:41:38Z","closed_at":null,"body":"Passing a wrong 'include' filter to one of the generated find services, shutdown the app with the given error: \r\n\r\n```\r\nTypeError: Cannot read property 'toString' of undefined\r\n    at KVMap.keyToString (/usr/src/app/node_modules/loopback-datasource-juggler/lib/include_utils.js:69:46)\r\n    at Object.KVMap.mapImpl.set (/usr/src/app/node_modules/loopback-datasource-juggler/lib/include_utils.js:75:13)\r\n    at Object.buildOneToOneIdentityMapWithOrigKeys (/usr/src/app/node_modules/loopback-datasource-juggler/lib/include_utils.js:24:11)\r\n    at includeHasManySimple (/usr/src/app/node_modules/loopback-datasource-juggler/lib/include.js:503:36)\r\n    at processIncludeItem (/usr/src/app/node_modules/loopback-datasource-juggler/lib/include.js:280:16)\r\n    at /usr/src/app/node_modules/loopback-datasource-juggler/lib/include.js:178:5\r\n    at /usr/src/app/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:157:13\r\n    at _each (/usr/src/app/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:57:9)\r\n    at Object.async.each (/usr/src/app/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:156:9)\r\n    at Function.Inclusion.include (/usr/src/app/node_modules/loopback-datasource-juggler/lib/include.js:177:9)\r\n```\r\n\r\nI know that the filter structure that i'm using is wrong but, should the app shutdown in that manner? Or return an error similar to the error returned when relation name is wrong. Something like that:\r\n\r\n```\r\n{\r\n  \"error\": {\r\n    \"name\": \"Error\",\r\n    \"status\": 500,\r\n    \"message\": \"Relation \\\"subZones\\\" is not defined for Zone model\"\r\n  }\r\n}\r\n```\r\n\r\nHere is my wrong 'include' filter:\r\n```\r\n\r\n{\r\n    include: {\r\n        relation: 'subZones',\r\n        fields: ['name'],\r\n        scope: {\r\n            include: {\r\n                relation: 'segmentControllers'\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n "},"comment":{"url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/comments/222843188","html_url":"https://github.com/strongloop/loopback-datasource-juggler/issues/951#issuecomment-222843188","issue_url":"https://api.github.com/repos/strongloop/loopback-datasource-juggler/issues/951","id":222843188,"user":{"login":"jgpacheco","id":8032466,"avatar_url":"https://avatars.githubusercontent.com/u/8032466?v=3","gravatar_id":"","url":"https://api.github.com/users/jgpacheco","html_url":"https://github.com/jgpacheco","followers_url":"https://api.github.com/users/jgpacheco/followers","following_url":"https://api.github.com/users/jgpacheco/following{/other_user}","gists_url":"https://api.github.com/users/jgpacheco/gists{/gist_id}","starred_url":"https://api.github.com/users/jgpacheco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgpacheco/subscriptions","organizations_url":"https://api.github.com/users/jgpacheco/orgs","repos_url":"https://api.github.com/users/jgpacheco/repos","events_url":"https://api.github.com/users/jgpacheco/events{/privacy}","received_events_url":"https://api.github.com/users/jgpacheco/received_events","type":"User","site_admin":false},"created_at":"2016-05-31T22:41:38Z","updated_at":"2016-05-31T22:41:38Z","body":"Sure, if i can help, tell me what to do. I'm a newbie developer BTW."}}
{"actor":{"display_login":"jgpacheco"}}