2013-08-06 27 views
10

Tôi đã nhận được lỗi này trong 2 ngày qua. Tôi đã thử mọi giải pháp thay đổi cấu hình đơn lẻ trên mạng. Các ứng dụng hoạt động tốt trong môi trường địa phương của tôi, nhưng nó có vẻ sụp đổ chỉ khi tôi triển khai để heroku, vì vậy tôi không chắc chắn nếu có bất cứ điều gì sai trái với mã của tôi. Ai có thể gợi ý tôi có thể làm gì tiếp theo? Dưới đây là nhật ký -Phương thức không xác định 'arity' dẫn đến lỗi 4 lỗi triển khai Heroku (H10)

2013-08-06T06:07:57.332143+00:00 app[web.1]: config.eager_load is set to nil. Please 
update your config/environments/*.rb files accordingly: 
2013-08-06T06:07:57.332143+00:00 app[web.1]: 
2013-08-06T06:07:57.332143+00:00 app[web.1]: * development - set it to false 
2013-08-06T06:07:57.332143+00:00 app[web.1]: * production - set it to true 
2013-08-06T06:07:57.332143+00:00 app[web.1]: * test - set it to false (unless you use a tool that preloads your test environment) 
2013-08-06T06:07:57.332143+00:00 app[web.1]: 
2013-08-06T06:07:57.433472+00:00 app[web.1]: params or add `protected_attributes` to your Gemfile to use the old one. 
2013-08-06T06:07:57.433472+00:00 app[web.1]: `config/application.rb` file and any `mass_assignment_sanitizer` options 
2013-08-06T06:07:57.433472+00:00 app[web.1]: from your `config/environments/*.rb` files. 
2013-08-06T06:07:57.433472+00:00 app[web.1]: See http://guides.rubyonrails.org/security.html#mass-assignment for more information. 
2013-08-06T06:07:57.433472+00:00 app[web.1]: To disable this message remove the `whitelist_attributes` option from your 
2013-08-06T06:07:57.433472+00:00 app[web.1]: out of Rails into a gem. Please use the new recommended protection model for 
2013-08-06T06:07:57.433472+00:00 app[web.1]: 
2013-08-06T06:07:57.433472+00:00 app[web.1]: 
2013-08-06T06:07:57.433472+00:00 app[web.1]: 
2013-08-06T06:07:57.433472+00:00 app[web.1]: DEPRECATION WARNING: Model based mass assignment security has been extracted 
2013-08-06T06:07:58.741762+00:00 app[web.1]: => Booting WEBrick 
2013-08-06T06:07:58.742020+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:58 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Application: My Application 
2013-08-06T06:07:58.741762+00:00 app[web.1]: => Rails 4.0.0 application starting in production on http://0.0.0.0:41380 
2013-08-06T06:07:58.741762+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:58 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Starting the New Relic agent in "production" environment. 
2013-08-06T06:07:58.741762+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:58 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : To prevent agent startup add a NEWRELIC_ENABLE=false environment variable or modify the "production" section of your newrelic.yml. 
2013-08-06T06:07:58.741762+00:00 app[web.1]: => Run `rails server -h` for more startup options 
2013-08-06T06:07:58.741762+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:58 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Reading configuration from config/newrelic.yml 
2013-08-06T06:07:58.741762+00:00 app[web.1]: => Ctrl-C to shutdown server 
2013-08-06T06:07:58.741762+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:58 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Environment: production 
2013-08-06T06:07:58.741762+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:58 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Enabling the Request Sampler. 
2013-08-06T06:07:58.741762+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:58 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Dispatcher: webrick 
2013-08-06T06:08:04.062061+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/associations/builder/association.rb:29:in `initialize': undefined method `arity' for :custom_type:Symbol (NoMethodError) 
2013-08-06T06:08:04.062061+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/associations.rb:1401:in `belongs_to' 
2013-08-06T06:08:04.062061+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
2013-08-06T06:08:04.062061+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require' 
2013-08-06T06:08:04.062061+00:00 app[web.1]: from /app/app/models/field.rb:4:in `<class:Field>' 
2013-08-06T06:08:04.062061+00:00 app[web.1]: from /app/app/models/field.rb:1:in `<top (required)>' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component' 
2013-08-06T06:08:04.062061+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/associations/builder/association.rb:12:in `new' 
2013-08-06T06:08:04.062319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers' 
2013-08-06T06:08:04.062319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec' 
2013-08-06T06:08:04.062061+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/associations/builder/association.rb:12:in `build' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:347:in `eager_load!' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each' 
2013-08-06T06:08:04.062061+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency' 
2013-08-06T06:08:04.062319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component' 
2013-08-06T06:08:04.062319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:288:in `depend_on' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/config.ru:3:in `block in <main>' 
2013-08-06T06:08:04.062061+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/association_builder.rb:70:in `initialize_with_deprecated_options' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/config.ru:in `<main>' 
2013-08-06T06:08:04.062319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
2013-08-06T06:08:04.062319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:329:in `require_or_load' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string' 
2013-08-06T06:08:04.062319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:206:in `require_dependency' 
2013-08-06T06:08:04.062319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run' 
2013-08-06T06:08:04.062319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!' 
2013-08-06T06:08:04.062751+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
2013-08-06T06:08:04.063540+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/config.ru:in `new' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config' 
2013-08-06T06:08:04.063540+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app' 
2013-08-06T06:08:04.063540+00:00 app[web.1]: from bin/rails:4:in `require' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers' 
2013-08-06T06:08:04.062906+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency' 
2013-08-06T06:08:04.063540+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize' 
2013-08-06T06:08:04.063540+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>' 
2013-08-06T06:08:04.063540+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start' 
2013-08-06T06:08:04.063540+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap' 
2013-08-06T06:08:04.063540+00:00 app[web.1]: from bin/rails:4:in `<main>' 
2013-08-06T06:08:04.063055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file' 
2013-08-06T06:08:04.063540+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app' 
2013-08-06T06:08:04.178658+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:59 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Installing deferred Rack instrumentation 
2013-08-06T06:08:04.178658+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:59 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Installing Rails 4 Controller instrumentation 
2013-08-06T06:08:04.178658+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:59 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Installing Rails4 Error instrumentation 
2013-08-06T06:08:04.178658+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:59 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Installing Net instrumentation 
2013-08-06T06:08:04.178658+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:59 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Installing Rails 4 view instrumentation 
2013-08-06T06:08:04.178658+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:59 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Finished instrumentation 
2013-08-06T06:08:04.178658+00:00 app[web.1]: ** [NewRelic][08/06/13 06:07:59 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Installing ActiveRecord 4 instrumentation 
2013-08-06T06:08:04.178658+00:00 app[web.1]: ** [NewRelic][08/06/13 06:08:00 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Reporting to: https://rpm.newrelic.com/accounts/386768/applications/***** 
2013-08-06T06:08:04.178658+00:00 app[web.1]: Exiting 
2013-08-06T06:08:04.178658+00:00 app[web.1]: ** [NewRelic][08/06/13 06:08:03 +0000 bc4e42fd-685e-4f33-81fe-77ff7b0aa790 (2)] INFO : Starting Agent shutdown 
2013-08-06T06:08:05.648375+00:00 heroku[web.1]: Process exited with status 1 
2013-08-06T06:08:05.665239+00:00 heroku[web.1]: State changed from starting to crashed 
2013-08-06T06:08:08.293497+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=***** fwd="65.128.39.118" dyno= connect= service= status=503 bytes= 
2013-08-06T06:08:08.516985+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=***** fwd="65.128.39.118" dyno= connect= service= status=503 bytes= 
2013-08-06T06:08:15.570976+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=***** fwd="65.128.39.118" dyno= connect= service= status=503 bytes= 

Các ***** thể hiện thông tin ẩn trên mục đích

Trả lời

39

I don' t nghĩ rằng vấn đề có liên quan đến heroku. Tôi đã có một sai lầm trong một trong những mô hình của tôi, nơi tôi đã có một cái gì đó như belongs_to :type1, :type2, mà tôi nên có chúng trong 2 dòng riêng biệt - như belongs_to :type1 belongs_to :type2 (Weird rằng cào không ném bất kỳ lỗi nào trong địa phương của tôi).

Sau khi sửa lỗi này, tôi cũng gặp sự cố khác. Heroku đã ném lỗi này -

Fetching gem metadata from https://rubygems.org/.. 
Could not find safe_yaml-0.9.4 in any of the sources 

Tôi không có safe_yaml-0.9.4 trong tệp Gemfile, nhưng thấy rằng nó đã được đưa vào Gemfile.lock của tôi. Tôi đã thay đổi safe_yaml-0.9.4 thành safe_yaml-0.9.3 và đẩy vào heroku. Mọi thứ trở lại bình thường bây giờ.

Xin lỗi vì tiêu đề gây hiểu lầm. Nhưng nếu có ai khác gặp lỗi arity với heroku giống như tôi đã làm, điều này có thể có thể đưa ra giải pháp.

0

Đến Look production.rb file in config/environments

của bạn cho các dòng config.eager_load và điều chỉnh nó để config.eager_load = true

+0

Dường như nó không hoạt động. Bây giờ tôi nhận được lỗi "/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/associations/builder/association.rb:29:in' initialize ': phương thức undefined 'arity 'for: custom_type: Biểu tượng (NoMethodError) "- bên dưới thông điệp NewRelic khi tôi đẩy nó vào heroku –

+0

Có thể tệp production.rb của bạn đã bị vô tình thay đổi. Đây là tệp [production.rb mặc định] (https://gist.github.com/althafhameez/6162635). Thay đổi AppName trong dòng đầu tiên thành tên ứng dụng đường ray của bạn và thử nếu nó hoạt động. –

+0

Tôi không nghĩ vậy. Cam kết cuối cùng trong lịch sử kiểm soát nguồn (không bao gồm thay đổi tải mong muốn mà tôi vừa thực hiện) là thay đổi ban đầu. –

Các vấn đề liên quan