{"action":"closed","issue":{"url":"https://api.github.com/repos/serverless/serverless/issues/2607","repository_url":"https://api.github.com/repos/serverless/serverless","labels_url":"https://api.github.com/repos/serverless/serverless/issues/2607/labels{/name}","comments_url":"https://api.github.com/repos/serverless/serverless/issues/2607/comments","events_url":"https://api.github.com/repos/serverless/serverless/issues/2607/events","html_url":"https://github.com/serverless/serverless/issues/2607","id":187041072,"number":2607,"title":"getEventInFunction unexpected implementation","user":{"login":"gertjvr","id":1691062,"avatar_url":"https://avatars3.githubusercontent.com/u/1691062?v=3","gravatar_id":"","url":"https://api.github.com/users/gertjvr","html_url":"https://github.com/gertjvr","followers_url":"https://api.github.com/users/gertjvr/followers","following_url":"https://api.github.com/users/gertjvr/following{/other_user}","gists_url":"https://api.github.com/users/gertjvr/gists{/gist_id}","starred_url":"https://api.github.com/users/gertjvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gertjvr/subscriptions","organizations_url":"https://api.github.com/users/gertjvr/orgs","repos_url":"https://api.github.com/users/gertjvr/repos","events_url":"https://api.github.com/users/gertjvr/events{/privacy}","received_events_url":"https://api.github.com/users/gertjvr/received_events","type":"User","site_admin":false},"labels":[{"id":417327117,"url":"https://api.github.com/repos/serverless/serverless/labels/kind/bug","name":"kind/bug","color":"FF8C94","default":false},{"id":420106925,"url":"https://api.github.com/repos/serverless/serverless/labels/status/easy-pick","name":"status/easy-pick","color":"3B8686","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-03T12:01:00Z","updated_at":"2017-04-17T07:21:49Z","closed_at":"2017-04-17T07:21:49Z","body":"# This is a Bug Report\r\n\r\n## Description\r\n\r\nCalling `this.serverless.service.getEventsInFunction(\"noop\")` fails due to function.events is an array and not and object, similar issue with `getAllEventsInFunction`\r\n\r\nI am aware this function isn't used anywhere, we should either remove the function or correctly implement it.\r\n\r\n```js\r\n  getEventInFunction(eventName, functionName) {\r\n    if (eventName in this.getFunction(functionName).events) {\r\n      return this.getFunction(functionName).events[eventName];\r\n    }\r\n    throw new SError(`Event \"${eventName}\" doesn't exist in function \"${functionName}\"`);\r\n  }\r\n\r\n  getAllEventsInFunction(functionName) {\r\n    return Object.keys(this.getFunction(functionName).events);\r\n  }\r\n```\r\n\r\nImplementation is [here](https://github.com/serverless/serverless/blob/master/lib/classes/Service.js#L185)\r\n\r\nExample service definition.\r\n\r\n```yml\r\nnoop:\r\n    handler: index.handler\r\n    events:\r\n      - http:\r\n          path: api\r\n          method: get\r\n```\r\n\r\nSimilar or dependent issues:\r\n* this was mentioned in [#2027](https://github.com/serverless/serverless/issues/2027#issuecomment-244855884)\r\n\r\n## Additional Data\r\n\r\n* ***Serverless Framework Version you're using***: v1.0.2 - v1.1.0\r\n* ***Operating System***: Windows 10\r\n* ***Stack Trace***: \r\n* ***Provider Error messages***: \r\n"}}
{"actor":{"display_login":"pmuens"}}