{"action":"created","issue":{"url":"https://api.github.com/repos/cpjk/canary/issues/51","repository_url":"https://api.github.com/repos/cpjk/canary","labels_url":"https://api.github.com/repos/cpjk/canary/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/cpjk/canary/issues/51/comments","events_url":"https://api.github.com/repos/cpjk/canary/issues/51/events","html_url":"https://github.com/cpjk/canary/issues/51","id":187603214,"number":51,"title":"does canary integrate with guardian db?","user":{"login":"devekko","id":12806326,"avatar_url":"https://avatars.githubusercontent.com/u/12806326?v=3","gravatar_id":"","url":"https://api.github.com/users/devekko","html_url":"https://github.com/devekko","followers_url":"https://api.github.com/users/devekko/followers","following_url":"https://api.github.com/users/devekko/following{/other_user}","gists_url":"https://api.github.com/users/devekko/gists{/gist_id}","starred_url":"https://api.github.com/users/devekko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devekko/subscriptions","organizations_url":"https://api.github.com/users/devekko/orgs","repos_url":"https://api.github.com/users/devekko/repos","events_url":"https://api.github.com/users/devekko/events{/privacy}","received_events_url":"https://api.github.com/users/devekko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-11-07T00:36:14Z","updated_at":"2016-11-07T02:50:51Z","closed_at":null,"body":"hey there\r\n\r\nam wondering if Canary works ok with Guardian DB? \r\n\r\nthis is my first Phoenix app and so am unsure exactly if this is a Canary issue BUT\r\n\r\nwhen my controller is only loading resources via Canary I am ok\r\n\r\nwill follow-up with file info\r\n\r\nbeen going round in circles on this for a few days now\r\n\r\n```\r\n[info] GET /spaces\r\n[debug] QUERY OK source=\"guardian_tokens\" db=0.7ms\r\nSELECT g0.\"jti\", g0.\"typ\", g0.\"aud\", g0.\"iss\", g0.\"sub\", g0.\"exp\", g0.\"jwt\", g0.\"claims\", g0.\"inserted_at\", g0.\"updated_at\" FROM \"guardian_tokens\" AS g0 WHERE ((g0.\"jti\" = $1) AND (g0.\"aud\" = $2)) [\"bbe8075b-b204-4cd3-bb04-8871dc18e7d8\", \"User:1\"]\r\n[debug] QUERY OK source=\"users\" db=0.3ms queue=0.3ms\r\nSELECT u0.\"id\", u0.\"name\", u0.\"email\", u0.\"bio\", u0.\"zipcode\", u0.\"address\", u0.\"phone\", u0.\"inserted_at\", u0.\"updated_at\" FROM \"users\" AS u0 WHERE (u0.\"id\" = $1) [1]\r\n[debug] Processing by SavesonomacountyOrg.SpaceController.index/2\r\n  Parameters: %{}\r\n  Pipelines: [:browser, :browser_auth, :require_login]\r\n[debug] QUERY OK source=\"spaces\" db=0.2ms\r\nSELECT s0.\"id\", s0.\"name\", s0.\"user_id\", s0.\"inserted_at\", s0.\"updated_at\" FROM \"spaces\" AS s0 []\r\n[debug] QUERY OK source=\"spaces\" db=0.1ms\r\nSELECT s0.\"id\", s0.\"name\", s0.\"user_id\", s0.\"inserted_at\", s0.\"updated_at\" FROM \"spaces\" AS s0 []\r\n```\r\n\r\nwhen my controller is trying to authorize I get Guardian DB errors\r\n```\r\n\r\n[error] #PID<0.1392.0> running SavesonomacountyOrg.Endpoint terminated\r\nServer: website.io:4000 (http)\r\nRequest: GET /spaces\r\n** (exit) an exception was raised:\r\n    ** (KeyError) key :guardian_default_resource not found in: %{current_user: %SavesonomacountyOrg.User{__meta__: #Ecto.Schema.Metadata<:loaded, \"users\">, address: nil, authorizations: #Ecto.Association.NotLoaded<association :authorizations is not loaded>, bio: nil, email: \"niccolo.roberts@gmail.com\", id: 1, inserted_at: #Ecto.DateTime<2016-11-06 21:46:22>, name: \"Nicholas Roberts\", phone: nil, spaces: #Ecto.Association.NotLoaded<association :spaces is not loaded>, updated_at: #Ecto.DateTime<2016-11-06 21:46:22>, zipcode: nil}, spaces: [%SavesonomacountyOrg.Space{__meta__: #Ecto.Schema.Metadata<:loaded, \"spaces\">, id: 2, inserted_at: #Ecto.DateTime<2016-11-06 21:58:34>, name: \"rr2\", updated_at: #Ecto.DateTime<2016-11-06 21:58:44>, user: #Ecto.Association.NotLoaded<association :user is not loaded>, user_id: 1}]}\r\n        (elixir) lib/map.ex:164: Map.fetch!/2\r\n        lib/canary/plugs.ex:193: Canary.Plugs._authorize_resource/2\r\n        lib/canary/plugs.ex:186: Canary.Plugs.authorize_resource/2\r\n        lib/canary/plugs.ex:267: Canary.Plugs._load_and_authorize_resource/2\r\n        (savesonomacounty_org) web/controllers/space_controller.ex:1: SavesonomacountyOrg.SpaceController.phoenix_controller_pipeline/2\r\n        (savesonomacounty_org) lib/savesonomacounty_org/endpoint.ex:1: SavesonomacountyOrg.Endpoint.instrument/4\r\n        (savesonomacounty_org) lib/phoenix/router.ex:261: SavesonomacountyOrg.Router.dispatch/2\r\n        (savesonomacounty_org) web/router.ex:1: SavesonomacountyOrg.Router.do_call/2\r\n        (savesonomacounty_org) lib/savesonomacounty_org/endpoint.ex:1: SavesonomacountyOrg.Endpoint.phoenix_pipeline/1\r\n        (savesonomacounty_org) lib/plug/debugger.ex:123: SavesonomacountyOrg.Endpoint.\"call (overridable 3)\"/2\r\n        (savesonomacounty_org) lib/savesonomacounty_org/endpoint.ex:1: SavesonomacountyOrg.Endpoint.call/2\r\n        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4\r\n        (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4\r\n```\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cpjk/canary/issues/comments/258736064","html_url":"https://github.com/cpjk/canary/issues/51#issuecomment-258736064","issue_url":"https://api.github.com/repos/cpjk/canary/issues/51","id":258736064,"user":{"login":"cpjk","id":3213506,"avatar_url":"https://avatars.githubusercontent.com/u/3213506?v=3","gravatar_id":"","url":"https://api.github.com/users/cpjk","html_url":"https://github.com/cpjk","followers_url":"https://api.github.com/users/cpjk/followers","following_url":"https://api.github.com/users/cpjk/following{/other_user}","gists_url":"https://api.github.com/users/cpjk/gists{/gist_id}","starred_url":"https://api.github.com/users/cpjk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpjk/subscriptions","organizations_url":"https://api.github.com/users/cpjk/orgs","repos_url":"https://api.github.com/users/cpjk/repos","events_url":"https://api.github.com/users/cpjk/events{/privacy}","received_events_url":"https://api.github.com/users/cpjk/received_events","type":"User","site_admin":false},"created_at":"2016-11-07T02:50:51Z","updated_at":"2016-11-07T02:50:51Z","body":"If you look at the output of the first comman, you'll see `current_user`. In the second and third you are passing a variable to the [] operator instead of a symbol. Use `:current_user` instead of `current_user`"}}
{"actor":{"display_login":"cpjk"}}