我正在设置一个简单的钢铁工人主/从工人
但我一直都会收到这个错误
/Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/wrappers/typhoeus_wrapper.rb:66:in `handle_response': HTTP 400 Error. (Rest::HttpError)from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/wrappers/typhoeus_wrapper.rb:74:in `post'
from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/client.rb:195:in `block in post'
from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/client.rb:142:in `perform_op'
from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/client.rb:194:in `post'
from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/iron_core-1.0.1/lib/iron_core/client.rb:192:in `post'
from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/iron_worker_ng-1.0.4/lib/iron_worker_ng/api_client.rb:71:in `tasks_create'
from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/iron_worker_ng-1.0.4/lib/iron_worker_ng/client.rb:282:in `tasks_create'
from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/iron_worker_ng-1.0.4/lib/iron_worker_ng/client.rb:18:in `method_missing'
from /var/folders/lf/gbbgv7mn7_15znyc0m92x3nh0000gn/T/iron-worker-ng-20131209-65715-1wav70r-container/messages_dispatcher.rb:26:in `block in <top (required)>'
from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/activerecord-4.0.0/lib/active_record/relation/delegation.rb:13:in `each'
from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/activerecord-4.0.0/lib/active_record/relation/delegation.rb:13:in `each'
from /var/folders/lf/gbbgv7mn7_15znyc0m92x3nh0000gn/T/iron-worker-ng-20131209-65715-1wav70r-container/messages_dispatcher.rb:24:in `<top (required)>'
from __runner__.rb:213:in `require'
from __runner__.rb:213:in `<main>'
以下是产生此错误的代码:
大师:*messages_dispatcher.rb*
require 'models/authentication
require 'iron_worker_ng'
require 'active_record'
require 'models/authentication'
require 'models/user'
ActiveRecord::Base.establish_connection('token and secret deleted')
client = IronWorkerNG::Client.new(:token => "token here", :project_id => "project id here")
@auth = Authentication.all
@auth.each do |a|
This line is producing the error
client.tasks.create("TweetMessagesWorker", user_id: a.user_id)
end
*messages_dispatcher.worker*
runtime "ruby"
gem "pg"
gem "activerecord"
exec "messages_dispatcher.rb"
# Merging models
dir '../app/models/'
full_remote_build true # Or remote
从:*messages_worker.rb*
require 'iron_worker_ng'
puts params[:user_id]
# For simplicity I have omitted some code here
*messages_worker.worker*
runtime "ruby"
name 'TweetMessagesWorker'
exec 'messages_worker.rb'
full_remote_build true # Or remote
有人有类似的问题吗。如果我用"斑疹伤寒"宝石代替"其余",我在同一行上同样会得到400个错误。
非常感谢您的帮助!
请确保您已首先使用codes.create
上传了您的工作人员。400通常是由服务器上不存在的代码引起的。
ruby http客户端隐藏了现在返回的消息,我将研究ruby的内容,以确保消息正确显示,而不仅仅是错误代码。