{"action":"created","issue":{"url":"https://api.github.com/repos/Storj/bridge/issues/77","repository_url":"https://api.github.com/repos/Storj/bridge","labels_url":"https://api.github.com/repos/Storj/bridge/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/Storj/bridge/issues/77/comments","events_url":"https://api.github.com/repos/Storj/bridge/issues/77/events","html_url":"https://github.com/Storj/bridge/issues/77","id":156984710,"number":77,"title":"Invalid _id when querying for Bucket","user":{"login":"phutchins","id":1074345,"avatar_url":"https://avatars.githubusercontent.com/u/1074345?v=3","gravatar_id":"","url":"https://api.github.com/users/phutchins","html_url":"https://github.com/phutchins","followers_url":"https://api.github.com/users/phutchins/followers","following_url":"https://api.github.com/users/phutchins/following{/other_user}","gists_url":"https://api.github.com/users/phutchins/gists{/gist_id}","starred_url":"https://api.github.com/users/phutchins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phutchins/subscriptions","organizations_url":"https://api.github.com/users/phutchins/orgs","repos_url":"https://api.github.com/users/phutchins/repos","events_url":"https://api.github.com/users/phutchins/events{/privacy}","received_events_url":"https://api.github.com/users/phutchins/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Storj/bridge/labels/bug","name":"bug","color":"EE3F46"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-26T13:33:45Z","updated_at":"2016-05-26T14:19:25Z","closed_at":null,"body":"I noticed a stack trace in the production API logs that is unable to find a Bucket by _id using req.params.id. It seems that req.params.id is not an ObjectId. It may should be cast to objectId, searched for using id instead of _id, or possibly should be searching some field other than _id.\r\n\r\n```\r\n{\"level\":\"error\",\"message\":\"request error: Cast to ObjectId failed for value \\\"[info]\\\" at path \\\"_id\\\"\",\"timestamp\":\"2016-05-26T11:46:27.439Z\"}\r\n{\"level\":\"error\",\"message\":\"CastError: Cast to ObjectId failed for value \\\"[info]\\\" at path \\\"_id\\\"\\n    at MongooseError.CastError (/opt/storj/bridge/node_modules/mongoose/lib/error/cast.js:19:11)\\n    at ObjectId.cast (/opt/storj/bridge/node_modules/mongoose/lib/schema/objectid.js:147:13)\\n    at ObjectId.castForQuery (/opt/storj/bridge/node_modules/mongoose/lib/schema/objectid.js:187:15)\\n    at cast (/opt/storj/bridge/node_modules/mongoose/lib/cast.js:174:32)\\n    at Query.cast (/opt/storj/bridge/node_modules/mongoose/lib/query.js:2580:10)\\n    at Query.findOne (/opt/storj/bridge/node_modules/mongoose/lib/query.js:1240:10)\\n    at Function.findOne (/opt/storj/bridge/node_modules/mongoose/lib/model.js:1272:13)\\n    at Query.<anonymous> (/opt/storj/bridge/lib/server/routes/buckets.js:499:16)\\n    at /opt/storj/bridge/node_modules/mongoose/node_modules/kareem/index.js:177:19\\n    at /opt/storj/bridge/node_modules/mongoose/node_modules/kareem/index.js:109:16\\n    at nextTickCallbackWith0Args (node.js:420:9)\\n    at process._tickCallback (node.js:349:13)\",\"timestamp\":\"2016-05-26T11:46:27.440Z\"}\r\n```\r\n\r\nbridge/ilb/server/routes/buckets.js:499 appears to be where this is happening.\r\n\r\nIt would be helpful to add some debug logging around this process to get a better idea of what is/should be going on."},"comment":{"url":"https://api.github.com/repos/Storj/bridge/issues/comments/221884351","html_url":"https://github.com/Storj/bridge/issues/77#issuecomment-221884351","issue_url":"https://api.github.com/repos/Storj/bridge/issues/77","id":221884351,"user":{"login":"gordonwritescode","id":1188875,"avatar_url":"https://avatars.githubusercontent.com/u/1188875?v=3","gravatar_id":"","url":"https://api.github.com/users/gordonwritescode","html_url":"https://github.com/gordonwritescode","followers_url":"https://api.github.com/users/gordonwritescode/followers","following_url":"https://api.github.com/users/gordonwritescode/following{/other_user}","gists_url":"https://api.github.com/users/gordonwritescode/gists{/gist_id}","starred_url":"https://api.github.com/users/gordonwritescode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gordonwritescode/subscriptions","organizations_url":"https://api.github.com/users/gordonwritescode/orgs","repos_url":"https://api.github.com/users/gordonwritescode/repos","events_url":"https://api.github.com/users/gordonwritescode/events{/privacy}","received_events_url":"https://api.github.com/users/gordonwritescode/received_events","type":"User","site_admin":false},"created_at":"2016-05-26T14:19:25Z","updated_at":"2016-05-26T14:19:25Z","body":"This is expected behavior and it is being casted to an object id. If the user requests a bucket by an invalid id, this will happen. The stack trace is printed for debugging purposes but does indicate a crash or restart. \r\n\r\nExample: GET /buckets/invalidobjectid"}}
{"actor":{"display_login":"gordonwritescode"}}