ページへの投稿の投稿で問題が発生しましたが、役立つエラーのみが表示されます。
OAuthException :: (#1) An error occured while creating the share
最初の20ほどの投稿はうまく機能し、その後エラーが発生し始めました。
Facebookには、ページ(スパム)などに投稿できる投稿数に制限がありますか?
フォームを複製できrails c
、access_tokenをトリプルチェックし、FBから直接手動で投稿できます。
(私はpage
自分のものではなくaccess_tokenを使用していますuser
)
FbGraphのgithupで問題を開きましたが、novはそれをFBの問題だと考えているようです。
私のコード:
admin = Admin.first
page = FbGraph::Page.new(admin.facebook_page_id)
Story.where(:facebook_post_id => nil).all.each do |story|
post = page.feed!(
:link => 'http://www.example.com/stories/'+story.cached_slug,
:access_token => admin.facebook_page_access_token
)
story.facebook_post_id = post.identifier
story.live = true
story.save
sleep 1
end
バックトレース:
FbGraph::InvalidRequest: OAuthException :: (#1) An error occured while creating the share
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/exception.rb:47:in `block in handle_httpclient_error'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/exception.rb:44:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/exception.rb:44:in `handle_httpclient_error'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/node.rb:142:in `handle_response'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/node.rb:55:in `post'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/connections/feed.rb:14:in `feed!'
from (irb):9:in `block in irb_binding'
from (irb):5:in `each'
from (irb):5
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
アップデート:
access_tokenが24時間禁止されたようです。
このエラーが再び発生する前に、ページにさらに28件の投稿を追加することができました。今回は10秒の睡眠で試しましたが、それでも禁止されました...明日は60秒の睡眠でやってみようと思います。:(