{"action":"created","issue":{"url":"https://api.github.com/repos/department-of-veterans-affairs/gi-bill-comparison-tool/issues/406","repository_url":"https://api.github.com/repos/department-of-veterans-affairs/gi-bill-comparison-tool","labels_url":"https://api.github.com/repos/department-of-veterans-affairs/gi-bill-comparison-tool/issues/406/labels{/name}","comments_url":"https://api.github.com/repos/department-of-veterans-affairs/gi-bill-comparison-tool/issues/406/comments","events_url":"https://api.github.com/repos/department-of-veterans-affairs/gi-bill-comparison-tool/issues/406/events","html_url":"https://github.com/department-of-veterans-affairs/gi-bill-comparison-tool/issues/406","id":176510903,"number":406,"title":"500 server error due to get institutions profile with no facility code","user":{"login":"patrickvinograd","id":20694532,"avatar_url":"https://avatars.githubusercontent.com/u/20694532?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickvinograd","html_url":"https://github.com/patrickvinograd","followers_url":"https://api.github.com/users/patrickvinograd/followers","following_url":"https://api.github.com/users/patrickvinograd/following{/other_user}","gists_url":"https://api.github.com/users/patrickvinograd/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickvinograd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickvinograd/subscriptions","organizations_url":"https://api.github.com/users/patrickvinograd/orgs","repos_url":"https://api.github.com/users/patrickvinograd/repos","events_url":"https://api.github.com/users/patrickvinograd/events{/privacy}","received_events_url":"https://api.github.com/users/patrickvinograd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-12T23:30:38Z","updated_at":"2016-09-26T21:58:16Z","closed_at":null,"body":"Production GIBCT has several 500 Internal Server Errors in the logs with flows like this:\r\n```\r\nI, [2016-09-07T19:17:47.996471 #2397]  INFO -- : Started GET \"/gi-bill-comparison-tool/institutions/profile\" for 152.131.36.97 at 2016-09-07 19:17:47 -0400\r\nI, [2016-09-07T19:17:48.003722 #2397]  INFO -- : Processing by InstitutionsController#profile as */*\r\nD, [2016-09-07T19:17:48.005282 #2397] DEBUG -- :   ESC[1mESC[36mInstitution Load\r\n (0.9ms)ESC[0m  ESC[1mSELECT  \"institutions\".* FROM \"institutions\" WHERE \"institutions\".\"facility_code\" IS NULL LIMIT 1ESC[0m\r\nI, [2016-09-07T19:17:48.016436 #2397]  INFO -- : Completed 500 Internal Server Error in 13ms (ActiveRecord: 0.9ms)\r\nF, [2016-09-07T19:17:48.016973 #2397] FATAL -- :\r\nNoMethodError (undefined method `get_veteran_retention_rate' for nil:NilClass):  app/controllers/institutions_controller.rb:26:in `profile'\r\n```\r\n\r\n1. institutions_controller.rb does not have an adequate guard against Institution.find_by not returning anything, and then tries to call get_veteran_retention_rate on a nil\r\n2. Not sure how /institutions/profile is being called with no facility code parameter, whether that's an error in autocomplete or something else. \r\n"},"comment":{"url":"https://api.github.com/repos/department-of-veterans-affairs/gi-bill-comparison-tool/issues/comments/249710024","html_url":"https://github.com/department-of-veterans-affairs/gi-bill-comparison-tool/issues/406#issuecomment-249710024","issue_url":"https://api.github.com/repos/department-of-veterans-affairs/gi-bill-comparison-tool/issues/406","id":249710024,"user":{"login":"patrickvinograd","id":20694532,"avatar_url":"https://avatars.githubusercontent.com/u/20694532?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickvinograd","html_url":"https://github.com/patrickvinograd","followers_url":"https://api.github.com/users/patrickvinograd/followers","following_url":"https://api.github.com/users/patrickvinograd/following{/other_user}","gists_url":"https://api.github.com/users/patrickvinograd/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickvinograd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickvinograd/subscriptions","organizations_url":"https://api.github.com/users/patrickvinograd/orgs","repos_url":"https://api.github.com/users/patrickvinograd/repos","events_url":"https://api.github.com/users/patrickvinograd/events{/privacy}","received_events_url":"https://api.github.com/users/patrickvinograd/received_events","type":"User","site_admin":false},"created_at":"2016-09-26T21:58:16Z","updated_at":"2016-09-26T21:58:16Z","body":"Most of the instances of this look like somebody editing a URL from a previouis query and omitting the facility_code parameter, e.g. entering \"gi-bill-comparison-tool/institutions/profile\" with no query params at all. There are a few that do include a facility_code and for which when I retry the logged query params, I get a successful result in dev, but not in prod or staging. Perhaps those institutions were removed from the tool and bookmarked results are now returning errors. \r\n\r\nIn any case I don't think there's any big logic error, just need to guard against a nil find_by and return a suitable error result like a 404. "}}
{"actor":{"display_login":"patrickvinograd"}}