{"action":"created","issue":{"url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/106","repository_url":"https://api.github.com/repos/contentful/contentful-management.rb","labels_url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/106/comments","events_url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/106/events","html_url":"https://github.com/contentful/contentful-management.rb/issues/106","id":171294030,"number":106,"title":"Erroneously reporting 'Service Unavailable, contenful.com API seems to be down'","user":{"login":"qbunt","id":187095,"avatar_url":"https://avatars.githubusercontent.com/u/187095?v=3","gravatar_id":"","url":"https://api.github.com/users/qbunt","html_url":"https://github.com/qbunt","followers_url":"https://api.github.com/users/qbunt/followers","following_url":"https://api.github.com/users/qbunt/following{/other_user}","gists_url":"https://api.github.com/users/qbunt/gists{/gist_id}","starred_url":"https://api.github.com/users/qbunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qbunt/subscriptions","organizations_url":"https://api.github.com/users/qbunt/orgs","repos_url":"https://api.github.com/users/qbunt/repos","events_url":"https://api.github.com/users/qbunt/events{/privacy}","received_events_url":"https://api.github.com/users/qbunt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/contentful/contentful-management.rb/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"dlitvakb","id":1032706,"avatar_url":"https://avatars.githubusercontent.com/u/1032706?v=3","gravatar_id":"","url":"https://api.github.com/users/dlitvakb","html_url":"https://github.com/dlitvakb","followers_url":"https://api.github.com/users/dlitvakb/followers","following_url":"https://api.github.com/users/dlitvakb/following{/other_user}","gists_url":"https://api.github.com/users/dlitvakb/gists{/gist_id}","starred_url":"https://api.github.com/users/dlitvakb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlitvakb/subscriptions","organizations_url":"https://api.github.com/users/dlitvakb/orgs","repos_url":"https://api.github.com/users/dlitvakb/repos","events_url":"https://api.github.com/users/dlitvakb/events{/privacy}","received_events_url":"https://api.github.com/users/dlitvakb/received_events","type":"User","site_admin":false},"assignees":[{"login":"dlitvakb","id":1032706,"avatar_url":"https://avatars.githubusercontent.com/u/1032706?v=3","gravatar_id":"","url":"https://api.github.com/users/dlitvakb","html_url":"https://github.com/dlitvakb","followers_url":"https://api.github.com/users/dlitvakb/followers","following_url":"https://api.github.com/users/dlitvakb/following{/other_user}","gists_url":"https://api.github.com/users/dlitvakb/gists{/gist_id}","starred_url":"https://api.github.com/users/dlitvakb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlitvakb/subscriptions","organizations_url":"https://api.github.com/users/dlitvakb/orgs","repos_url":"https://api.github.com/users/dlitvakb/repos","events_url":"https://api.github.com/users/dlitvakb/events{/privacy}","received_events_url":"https://api.github.com/users/dlitvakb/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2016-08-16T00:29:41Z","updated_at":"2016-08-17T11:50:55Z","closed_at":null,"body":"Using the following code:\r\n\r\n```\r\nrequire 'contentful/management'\r\n\r\nTOKEN_FILE_PATH = \"./data/.oauth.token\"\r\nSPACE_ID = \"pzben22qc4sf\"\r\n\r\ndef get_access_token\r\n  # check for the existence of the /data/.oauth.token file\r\n  if File.exists? TOKEN_FILE_PATH\r\n    open(TOKEN_FILE_PATH).read\r\n  else\r\n    raise \"Please authenticate the application before using this tool\"\r\n  end\r\nend\r\n\r\nputs \"ACCESS TOKEN: #{get_access_token}\"\r\nputs \"SPACE_ID: #{SPACE_ID}\"\r\n\r\nclient = Contentful::Management::Client.new(get_access_token)\r\nputs client\r\nspace = client.spaces.find(SPACE_ID)\r\nputs space\r\nspace.assets.all\r\n```\r\n\r\nWe get the following output:\r\n\r\n```\r\n#<Contentful::Management::Client:0x007fc192162500>\r\nService Unavailable, contenful.com API seems to be down\r\ntest.rb:22:in `<main>': undefined method `assets' for #<Contentful::Management::ServiceUnavailable:0x007fc1921a8960> (NoMethodError)\r\n```\r\n\r\nUsing the same space, same accessToken in Node, everything runs fine and nothing reports as a 503 (because everything is operational and online).\r\n\r\nThis recently just caused us a couple of days of issues because we assumed that the bridge was down, and it clearly isn't.\r\n\r\nLooking at the code, it looks like maybe there's a condition that's not getting handled or getting mapped to an error hash that isn't entirely right."},"comment":{"url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/comments/240389007","html_url":"https://github.com/contentful/contentful-management.rb/issues/106#issuecomment-240389007","issue_url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/106","id":240389007,"user":{"login":"dlitvakb","id":1032706,"avatar_url":"https://avatars.githubusercontent.com/u/1032706?v=3","gravatar_id":"","url":"https://api.github.com/users/dlitvakb","html_url":"https://github.com/dlitvakb","followers_url":"https://api.github.com/users/dlitvakb/followers","following_url":"https://api.github.com/users/dlitvakb/following{/other_user}","gists_url":"https://api.github.com/users/dlitvakb/gists{/gist_id}","starred_url":"https://api.github.com/users/dlitvakb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlitvakb/subscriptions","organizations_url":"https://api.github.com/users/dlitvakb/orgs","repos_url":"https://api.github.com/users/dlitvakb/repos","events_url":"https://api.github.com/users/dlitvakb/events{/privacy}","received_events_url":"https://api.github.com/users/dlitvakb/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T11:50:55Z","updated_at":"2016-08-17T11:50:55Z","body":"Hey @qbunt,\r\n\r\nWhat happens when you use the token directly?\r\n\r\nIf it works, could you check that the path you're using is correct and that the file is properly being read? I'd recommend not using relative paths and using `File.join(File.dirname(__FILE__), 'data', '.oauth.token')` to get the proper path from the current working file.\r\n\r\nPlease let me know if that helps\r\n\r\nCheers"}}
{"actor":{"display_login":"dlitvakb"}}