{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/964","labels_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/964/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/964/comments","events_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/964/events","html_url":"https://github.com/mozilla/fxa-auth-server/pull/964","id":87206561,"number":964,"title":"Check for 400 from check password","user":{"login":"chilts","id":3048,"avatar_url":"https://avatars.githubusercontent.com/u/3048?v=3","gravatar_id":"","url":"https://api.github.com/users/chilts","html_url":"https://github.com/chilts","followers_url":"https://api.github.com/users/chilts/followers","following_url":"https://api.github.com/users/chilts/following{/other_user}","gists_url":"https://api.github.com/users/chilts/gists{/gist_id}","starred_url":"https://api.github.com/users/chilts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chilts/subscriptions","organizations_url":"https://api.github.com/users/chilts/orgs","repos_url":"https://api.github.com/users/chilts/repos","events_url":"https://api.github.com/users/chilts/events{/privacy}","received_events_url":"https://api.github.com/users/chilts/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla/fxa-auth-server/labels/waffle:in%20progress","name":"waffle:in progress","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"chilts","id":3048,"avatar_url":"https://avatars.githubusercontent.com/u/3048?v=3","gravatar_id":"","url":"https://api.github.com/users/chilts","html_url":"https://github.com/chilts","followers_url":"https://api.github.com/users/chilts/followers","following_url":"https://api.github.com/users/chilts/following{/other_user}","gists_url":"https://api.github.com/users/chilts/gists{/gist_id}","starred_url":"https://api.github.com/users/chilts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chilts/subscriptions","organizations_url":"https://api.github.com/users/chilts/orgs","repos_url":"https://api.github.com/users/chilts/repos","events_url":"https://api.github.com/users/chilts/events{/privacy}","received_events_url":"https://api.github.com/users/chilts/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mozilla/fxa-auth-server/milestones/29","html_url":"https://github.com/mozilla/fxa-auth-server/milestones/train-40","labels_url":"https://api.github.com/repos/mozilla/fxa-auth-server/milestones/29/labels","id":1146572,"number":29,"title":"train-40","description":null,"creator":{"login":"rfk","id":34695,"avatar_url":"https://avatars.githubusercontent.com/u/34695?v=3","gravatar_id":"","url":"https://api.github.com/users/rfk","html_url":"https://github.com/rfk","followers_url":"https://api.github.com/users/rfk/followers","following_url":"https://api.github.com/users/rfk/following{/other_user}","gists_url":"https://api.github.com/users/rfk/gists{/gist_id}","starred_url":"https://api.github.com/users/rfk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfk/subscriptions","organizations_url":"https://api.github.com/users/rfk/orgs","repos_url":"https://api.github.com/users/rfk/repos","events_url":"https://api.github.com/users/rfk/events{/privacy}","received_events_url":"https://api.github.com/users/rfk/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":1,"state":"open","created_at":"2015-06-03T06:37:52Z","updated_at":"2015-06-17T01:49:29Z","due_on":"2015-06-28T14:00:00Z","closed_at":null},"comments":3,"created_at":"2015-06-11T04:28:12Z","updated_at":"2015-06-17T10:34:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/964","html_url":"https://github.com/mozilla/fxa-auth-server/pull/964","diff_url":"https://github.com/mozilla/fxa-auth-server/pull/964.diff","patch_url":"https://github.com/mozilla/fxa-auth-server/pull/964.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/comments/112749123","html_url":"https://github.com/mozilla/fxa-auth-server/pull/964#issuecomment-112749123","issue_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/964","id":112749123,"user":{"login":"chilts","id":3048,"avatar_url":"https://avatars.githubusercontent.com/u/3048?v=3","gravatar_id":"","url":"https://api.github.com/users/chilts","html_url":"https://github.com/chilts","followers_url":"https://api.github.com/users/chilts/followers","following_url":"https://api.github.com/users/chilts/following{/other_user}","gists_url":"https://api.github.com/users/chilts/gists{/gist_id}","starred_url":"https://api.github.com/users/chilts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chilts/subscriptions","organizations_url":"https://api.github.com/users/chilts/orgs","repos_url":"https://api.github.com/users/chilts/repos","events_url":"https://api.github.com/users/chilts/events{/privacy}","received_events_url":"https://api.github.com/users/chilts/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T10:34:42Z","updated_at":"2015-06-17T10:34:42Z","body":"@rfkelly: Am just looking at your comment related to also checking the `errno`. It turns out that we can't actually do that.\r\n\r\nSince the result is whatever the db-server gave us, it doesn't actually give us the `errno`. Running a local db-server and hitting the check password endpoint gives us:\r\n\r\n```\r\n$ curl -v -X POST -H \"Content-Type: application/json\" -d '{ \"verifyHash\":\"5791981c2f0685aa9400597b6bee51d04c59399798e9bcf3cdbeec3d8b50971f\" }' http://localhost:8000/account/6044486dd15b42e08b1fb9167415b9ac/checkPassword\r\n> POST /account/6044486dd15b42e08b1fb9167415b9ac/checkPassword HTTP/1.1\r\n> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3\r\n> Host: localhost:8000\r\n> Accept: */*\r\n> Content-Type: application/json\r\n> Content-Length: 83\r\n> \r\n< HTTP/1.1 400 Bad Request\r\n< Content-Type: application/json\r\n< Content-Length: 32\r\n< Date: Wed, 17 Jun 2015 10:05:32 GMT\r\n< Connection: keep-alive\r\n< \r\n{\"message\":\"Incorrect password\"}\r\n```\r\n\r\nSo at the auth server, we don't have access to the `errno`. The thing we're doing here is (probably) not doing what we think it's doing : https://github.com/mozilla/fxa-auth-db-server/blob/master/index.js#L50 - I can see that inside restify, we're essentially converting from the error object into a much more simpler object which doesn't contain all of these fields.\r\n\r\nThe reason for this is deep in the bowels of restify. When we pass it the statusCode and error object, it goes through a few twists and turns but eventually the body (the error) ends up at the JSON formatter here : https://github.com/restify/node-restify/blob/master/lib/formatters/json.js#L16-L18\r\n\r\nAnd this is the reason why we only see the `message` in the response body above without any of the extra fields.\r\n\r\nSo the question is, should we be returning all these fields so that the auth-server can be checking them, just as has been assumed in the code review for this patch? Have we assumed so far that these should be returned, even if we've never actually used them at the auth server? If so, we'll have to change what we're doing with the error in the db-server.\r\n\r\nNow that I understand what's happening with the `res.send(..., ...)` it should be an easy enough fix.\r\n\r\n(Note, an easy peasy workaround to make this happen is `res.send(statusCode, JSON.parse(JSON.stringify(err)))` instead of `res.send(statusCode, err)` - I'm not advocating this as the real fix, just sayin' I found it during investigations.)\r\n"}}