{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/sails/issues/3863","repository_url":"https://api.github.com/repos/balderdashy/sails","labels_url":"https://api.github.com/repos/balderdashy/sails/issues/3863/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/sails/issues/3863/comments","events_url":"https://api.github.com/repos/balderdashy/sails/issues/3863/events","html_url":"https://github.com/balderdashy/sails/issues/3863","id":185208866,"number":3863,"title":"async controller throwing error","user":{"login":"adnan-kamili","id":1573517,"avatar_url":"https://avatars.githubusercontent.com/u/1573517?v=3","gravatar_id":"","url":"https://api.github.com/users/adnan-kamili","html_url":"https://github.com/adnan-kamili","followers_url":"https://api.github.com/users/adnan-kamili/followers","following_url":"https://api.github.com/users/adnan-kamili/following{/other_user}","gists_url":"https://api.github.com/users/adnan-kamili/gists{/gist_id}","starred_url":"https://api.github.com/users/adnan-kamili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adnan-kamili/subscriptions","organizations_url":"https://api.github.com/users/adnan-kamili/orgs","repos_url":"https://api.github.com/users/adnan-kamili/repos","events_url":"https://api.github.com/users/adnan-kamili/events{/privacy}","received_events_url":"https://api.github.com/users/adnan-kamili/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/balderdashy/sails/labels/Needs%20cleanup","name":"Needs cleanup","color":"009800"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-25T19:17:42Z","updated_at":"2016-10-25T19:21:27Z","closed_at":null,"body":"### BEGIN VERSION INFO ###\r\n-->\r\n**Sails version**: 0.12.7\r\n**Node version**: 7.0.0\r\n**NPM version**: 3.10.8\r\n**Operating system**: macOS Sierra\r\n<!-- \r\n### END VERSION INFO ###\r\n\r\n### BEGIN PLEDGE ###\r\n- [ X] I am experiencing a concrete technical issue (aka a bug) with Sails (ideas and feature proposals should follow the guide for proposing features and enhancements (http://bit.ly/sails-feature-guide), which involves making a pull request).  If you're not 100% certain whether it's a bug or not, that's okay--you may continue.  The worst that can happen is that the issue will be closed and we'll point you in the right direction.\r\n\r\n- [X ] I am not asking a question about how to use Sails or about whether or not Sails has a certain feature (please refer to the documentation(http://sailsjs.org), or post on http://stackoverflow.com, our Google Group (http://bit.ly/sails-google-group) or our live chat (https://gitter.im/balderdashy/sails).\r\n\r\n- [X ] I have already searched for related issues, and found none open (if you found a related _closed_ issue, please link to it in your post).\r\n\r\n- [ X] My issue title is concise, on-topic and polite (\"jst.js being removed from layout.ejs on lift\" is good; \"templates dont work\" or \"why is sails dumb\" are not so good).\r\n\r\n- [ X] I have tried all the following (if relevant) and my issue remains:\r\n  - Make sure you have the right app lifted.\r\n  - Make sure you've killed the Sails server with CTRL+C and started it again.\r\n  - Make sure you closed any open browser tabs pointed at localhost before starting Sails.\r\n  - Make sure you do not have any other Sails apps running in other terminal windows.\r\n  - Make sure the app you are using to reproduce the issue has a clean node_modules/ directory, meaning:\r\n    * no dependencies are linked (e.g. you haven't run npm link foo)\r\n    * that you haven't made any inline changes to files in the node_modules/ folder\r\n    * that you don't have any weird global dependency loops. The easiest way to double-check any of the above, if you aren't sure, is to run: rm -rf node_modules && npm cache clear && npm install.\r\n\r\nand finally...\r\n- [ X] **I can provide steps to reproduce this issue that others can follow.**\r\n\r\nIdeally, this involves creating a new repo that demonstrates the problem (see instructions at http://bit.ly/sails-issue-repro).  Even though your issue may seem so simple to reproduce that a new repo is unnecessary, you'd be surprised how many solutions present themselves when you start from `sails new` and attempt to recreate your issue from scratch in a new app.  This ensures that the real issue isn't in your user code (a forgotten policy file, perhaps?) or in a third-party module.  If you're absolutely _convinced_ that a new repo is unnecessary, provide clear, concise and _specific_ steps to reproduce the problem in your post (not \"create a model then do blueprint create\").\r\n### END PLEDGE ###\r\n\r\n\r\nBefore Node.js 7.0 was released my Sails.js controllers looked something similar to:\r\n\r\n```\r\nconst _async = require('asyncawait/async');\r\nconst _await = require('asyncawait/await');\r\n\r\n...\r\n\r\nget: _async (function (req, res) {\r\n    try {\r\n        let item = _await (Items.find({\r\n            id: req.params.id\r\n        }));\r\n        if (!item.length) {\r\n            return res.notFound(\"The item does not exist\");\r\n        }\r\n        return res.ok(item[0]);\r\n    } catch (error) {\r\n        return res.serverError(error);\r\n    }\r\n}),\r\n```\r\n\r\nEverything used to run perfectly. After the release of Node.js 7.0, I changed it to:\r\n\r\n ```\r\nget: async function (req, res) {\r\n    try {\r\n        let item = await Items.find({\r\n            id: req.params.id\r\n        });\r\n        if (!item.length) {\r\n            return res.notFound(\"The item does not exist\");\r\n        }\r\n        return res.ok(item[0]);\r\n    } catch (error) {\r\n        return res.serverError(error);\r\n    }\r\n},\r\n```\r\n\r\nBut it throws error:\r\n\r\nerror: In items.get, ignored invalid attempt to bind route to a \r\nnon-function controller: { [Function: get] _middlewareType: 'ACTION: \r\nitems/get' } for path:  /v1/items/:id and verb: get\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/balderdashy/sails/issues/comments/256148490","html_url":"https://github.com/balderdashy/sails/issues/3863#issuecomment-256148490","issue_url":"https://api.github.com/repos/balderdashy/sails/issues/3863","id":256148490,"user":{"login":"adnan-kamili","id":1573517,"avatar_url":"https://avatars.githubusercontent.com/u/1573517?v=3","gravatar_id":"","url":"https://api.github.com/users/adnan-kamili","html_url":"https://github.com/adnan-kamili","followers_url":"https://api.github.com/users/adnan-kamili/followers","following_url":"https://api.github.com/users/adnan-kamili/following{/other_user}","gists_url":"https://api.github.com/users/adnan-kamili/gists{/gist_id}","starred_url":"https://api.github.com/users/adnan-kamili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adnan-kamili/subscriptions","organizations_url":"https://api.github.com/users/adnan-kamili/orgs","repos_url":"https://api.github.com/users/adnan-kamili/repos","events_url":"https://api.github.com/users/adnan-kamili/events{/privacy}","received_events_url":"https://api.github.com/users/adnan-kamili/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T19:21:27Z","updated_at":"2016-10-25T19:21:27Z","body":"ok fixed"}}
{"actor":{"display_login":"adnan-kamili"}}