nov / fb_graph

This gem doesn't support FB Graph API v2.0+. Please use fb_graph2 gem instead.
MIT License
1.04k stars 191 forks source link

FbGraph::InvalidRequest: GraphMethodException :: Unsupported get request for some posts or comments #336

Closed achiinto closed 11 years ago

achiinto commented 11 years ago

I have no problem fetching these posts/comments using the GraphAPI explorer with the same social account with basic permission.

Any idea what is going on? I believe I was able to fetch these posts at one point using fb_graph gem.

post = FbGraph::Post.new("post_id...", access_token: @social_account.access_token).fetch FbGraph::InvalidRequest: GraphMethodException :: Unsupported get request. from /Users/filtered/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/fb_graph-2.7.8/lib/fb_graph/exception.rb:12:in handle_structured_response' from /Users/filtered/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/fb_graph-2.7.8/lib/fb_graph/node.rb:153:inhandle_response' from /Users/filtered/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/fb_graph-2.7.8/lib/fb_graph/node.rb:49:in get' from /Users/filtered/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/fb_graph-2.7.8/lib/fb_graph/node.rb:19:infetch'

tmlee commented 11 years ago

You're using jruby? i believe it might be a jruby issue.. we dont have a CI test for jruby it seems.

achiinto commented 11 years ago

Yup, sure, I will take a look if I can reproduce this in ruby. Odd thing is that most of the time it works and it used to work with that particular post id as well. I will try to investigate further and update on here.

nov commented 11 years ago

It's because unexpected "post_id..." was given, because of jruby issue or something other. Can you call FbGraph.debug! before calling fetch? Then you'll see which endpoint you are accessing. https://github.com/nov/fb_graph/wiki/Debugging

achiinto commented 11 years ago

This is what I am seeing.

irb(main):015:0> FbGraph.debug! => true irb(main):016:0> FbGraph::Post.new("506119627_10151816565954628", access_token: sa.access_token).fetch I, [2013-08-22T10:47:28.015000 #46982] INFO -- FbGraph: ======= [FbGraph] API REQUEST STARTED ======= I, [2013-08-22T10:47:28.016000 #46982] INFO -- FbGraph: GET /506119627_10151816565954628 HTTP/1.1 Host: graph.facebook.com

I, [2013-08-22T10:47:28.620000 #46982] INFO -- FbGraph: -------------------------------------------------- I, [2013-08-22T10:47:28.621000 #46982] INFO -- FbGraph: Status: 400 Bad Request Access-Control-Allow-Origin: * Cache-Control: no-store Content-Type: application/json; charset=UTF-8 Expires: Sat, 01 Jan 2000 00:00:00 GMT Pragma: no-cache WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "Unsupported get request." X-FB-Rev: 916172 X-FB-Debug: 1cqa1R16IN7J59aoKDISKDah2LRXgbvKz1HOV33D3WY= Date: Thu, 22 Aug 2013 14:47:26 GMT Connection: keep-alive Content-Length: 0

{"error":{"message":"Unsupported get request.","type":"GraphMethodException","code":100}} I, [2013-08-22T10:47:28.621000 #46982] INFO -- FbGraph: ======= [FbGraph] API REQUEST FINISHED ======= FbGraph::InvalidRequest: GraphMethodException :: Unsupported get request. from /Users//.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/fb_graph-2.7.7/lib/fb_graph/exception.rb:12:in handle_structured_response' from /Users/<filtered>/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/fb_graph-2.7.7/lib/fb_graph/node.rb:153:inhandle_response' from /Users//.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/fb_graph-2.7.7/lib/fb_graph/node.rb:49:in get' from /Users/<filtered>/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/fb_graph-2.7.7/lib/fb_graph/node.rb:19:infetch' from (irb):16:in evaluate' from org/jruby/RubyKernel.java:1093:ineval' from org/jruby/RubyKernel.java:1489:in loop' from org/jruby/RubyKernel.java:1254:incatch' from org/jruby/RubyKernel.java:1254:in catch' from /Users/<filtered>/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/railties-4.0.0/lib/rails/commands/console.rb:90:instart' from /Users//.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in start' from /Users/<filtered>/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/railties-4.0.0/lib/rails/commands.rb:64:in(root)' from org/jruby/RubyKernel.java:1054:in require' from bin/rails:4:in(root)'

achiinto commented 11 years ago

So it seems like the request is okay, but the response is not parsed right. Funny thing is that it worked for some post but not some other. And there seems to be signs that those post was able to be fetched and parsed without problem before and now not working.

achiinto commented 11 years ago

Using Ruby also reproduce the same issue.

irb(main):002:0> FbGraph.debug! => true irb(main):003:0> FbGraph::Post.new("506119627_10151816565954628", access_token: sa.access_token).fetch I, [2013-08-22T11:09:41.870697 #50246] INFO -- FbGraph: ======= [FbGraph] API REQUEST STARTED ======= I, [2013-08-22T11:09:41.870821 #50246] INFO -- FbGraph: GET /506119627_10151816565954628 HTTP/1.1 Host: graph.facebook.com

I, [2013-08-22T11:09:42.100190 #50246] INFO -- FbGraph: -------------------------------------------------- I, [2013-08-22T11:09:42.100346 #50246] INFO -- FbGraph: Status: 400 Bad Request Access-Control-Allow-Origin: * Cache-Control: no-store Content-Type: application/json; charset=UTF-8 Expires: Sat, 01 Jan 2000 00:00:00 GMT Pragma: no-cache WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "Unsupported get request." X-FB-Rev: 916172 X-FB-Debug: l2vFNfPC2WzPJQWrUswTYkCl72igpNAV7ar+XepPRQI= Date: Thu, 22 Aug 2013 15:09:39 GMT Connection: keep-alive Content-Length: 0

{"error":{"message":"Unsupported get request.","type":"GraphMethodException","code":100}} I, [2013-08-22T11:09:42.100467 #50246] INFO -- FbGraph: ======= [FbGraph] API REQUEST FINISHED ======= FbGraph::InvalidRequest: GraphMethodException :: Unsupported get request. from /Users//.rbenv/versions/2.0.0-p247/gemsets/ruby/gems/fb_graph-2.7.7/lib/fb_graph/exception.rb:12:in handle_structured_response' from /Users/<filtered>/.rbenv/versions/2.0.0-p247/gemsets/ruby/gems/fb_graph-2.7.7/lib/fb_graph/node.rb:153:inhandle_response' from /Users//.rbenv/versions/2.0.0-p247/gemsets/ruby/gems/fb_graph-2.7.7/lib/fb_graph/node.rb:49:in get' from /Users/<filtered>/.rbenv/versions/2.0.0-p247/gemsets/ruby/gems/fb_graph-2.7.7/lib/fb_graph/node.rb:19:infetch' from (irb):3 from /Users//.rbenv/versions/2.0.0-p247/gemsets/ruby/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in start' from /Users/<filtered>/.rbenv/versions/2.0.0-p247/gemsets/ruby/gems/railties-4.0.0/lib/rails/commands/console.rb:9:instart' from /Users//.rbenv/versions/2.0.0-p247/gemsets/ruby/gems/railties-4.0.0/lib/rails/commands.rb:64:in <top (required)>' from bin/rails:4:inrequire' from bin/rails:4:in `

'

achiinto commented 11 years ago

Actually, might be my own issue. Please close the ticket. Very likely the access token for the social account has expired and failing. I guess the Unsupported get request was kind of confusing, which FB should throw Oauth error instead.

Thanks for supporting.

achiinto commented 11 years ago

I looked into it a little bit further. It does not seems to be a token expiration problem, as the token could still be used to post. Not sure whey reseting it would make it work again for the fetching. But I was able to reproduce it using graph explorer on facebook. I think this has nothing to do with the gem, but rather an issue or behaviour on Facebook API.

https://developers.facebook.com/bugs/285682524881107

tmlee commented 11 years ago

@achiinto is that graph id publicly accessible? I tried accessing it via the FB API explorer and i am getting { "error": { "message": "Unsupported get request.", "type": "GraphMethodException", "code": 100 } } or is there any other ids is giving the same problem?

Also be sure to check the access token permission? Did you include something along the line of user_status?

achiinto commented 11 years ago

I think it is just permission related. Which is currently what Facebook API would return as an error message for insufficient permission. I will close this issue. Thanks for looking into this.