我正在建立一个简单的铁工大师/奴隶工作者,
但我一直得到这个错误
/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
有没有人有类似的问题。 如果我将'rest'替换为'typheous'宝石,我同样会在同一行上出现400错误。
非常感谢任何帮助!
答案 0 :(得分:0)
请务必先使用codes.create
上传您的工作人员。 400通常是由服务器上不存在的代码引起的。
ruby http客户端隐藏了现在返回的消息,我将查看ruby内容以确保消息正确显示而不仅仅是错误代码。