问题
Since the last commit I made to heroku whenever I try to access my application I keep getting this error "An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details."
So I run heroku logs command and I can't make much sense of the log errors. The most I understand is there is something wrong with the bcrypt gem but I'm not sure what. Any help/solution will be appreciated, thanks.
$ heroku logs
←[36m2013-07-06T17:18:26.969966+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
←[36m2013-07-06T17:18:26.969771+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
←[36m2013-07-06T17:18:26.969966+00:00 app[web.1]:←[0m from config.ru:3:in `block in <main>'
←[36m2013-07-06T17:18:26.970385+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `eval'
←[36m2013-07-06T17:18:26.970385+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `load'
←[36m2013-07-06T17:18:26.970385+00:00 app[web.1]:←[0m from config.ru:1:in `<main>'
←[36m2013-07-06T17:18:26.970385+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `<main>'
←[36m2013-07-06T17:18:26.969966+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
←[36m2013-07-06T17:18:26.969966+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
←[36m2013-07-06T17:18:26.970385+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/bin/thin:6:in `<top (required)>'
←[36m2013-07-06T17:18:26.969966+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
←[36m2013-07-06T17:18:26.969966+00:00 app[web.1]:←[0m from config.ru:3:in `require'
←[36m2013-07-06T17:18:26.970385+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
←[36m2013-07-06T17:18:26.970385+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:71:in `start'
←[36m2013-07-06T17:18:26.970385+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command'
←[36m2013-07-06T17:18:26.969966+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
←[36m2013-07-06T17:18:26.969966+00:00 app[web.1]:←[0m from config.ru:1:in `new'
←[36m2013-07-06T17:18:26.970385+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `load'
←[36m2013-07-06T17:18:28.491595+00:00 heroku[web.1]:←[0m Process exited with status 1
←[36m2013-07-06T17:18:28.500515+00:00 heroku[web.1]:←[0m State changed from starting to crashed
2013-07-06T17:21:11+00:00 heroku[slug-compiler]: Slug compilation started
←[33m2013-07-06T17:23:02.480186+00:00 heroku[api]:←[0m Deploy 9e263bb by blank@gmail.com
←[33m2013-07-06T17:23:02.502453+00:00 heroku[api]:←[0m Release v135 created by blank@gmail.com
←[33m2013-07-06T17:23:02.542045+00:00 heroku[api]:←[0m Deploy 9e263bb by blank@gmail.com
←[36m2013-07-06T17:23:02.621820+00:00 heroku[web.1]:←[0m State changed from crashed to starting
2013-07-06T17:23:03+00:00 heroku[slug-compiler]: Slug compilation finished
←[36m2013-07-06T17:23:08.258293+00:00 heroku[web.1]:←[0m Starting process with command `bundle exec thin start -R config.ru -e $RAILS_ENV -p 58707`
←[36m2013-07-06T17:23:16.272833+00:00 app[web.1]:←[0m DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move
them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
←[36m2013-07-06T17:23:16.273194+00:00 app[web.1]:←[0m DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move
them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
←[36m2013-07-06T17:23:21.753335+00:00 app[web.1]:←[0m
←[36m2013-07-06T17:23:21.753335+00:00 app[web.1]:←[0m Called from: /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/abstract_store.rb:28:
in `initialize'.
←[36m2013-07-06T17:23:21.753335+00:00 app[web.1]:←[0m
←[36m2013-07-06T17:23:26.052416+00:00 app[web.1]:←[0m Connecting to database specified by DATABASE_URL
←[36m2013-07-06T17:23:26.533047+00:00 app[web.1]:←[0m /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.3.2/lib/bundler/rubygems_integration.rb:224:in `block in replace_gem': can't activate bc
rypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.0. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
←[36m2013-07-06T17:23:26.534901+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:133:in `inherited'
←[36m2013-07-06T17:23:26.533047+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activemodel-3.2.8/lib/active_model/secure_password.rb:37:in `has_secure_password'
←[36m2013-07-06T17:23:26.533047+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-07-06T17:23:26.533047+00:00 app[web.1]:←[0m from /app/app/models/member.rb:1:in `<top (required)>'
←[36m2013-07-06T17:23:26.533679+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:192:in `block in const_missing'
←[36m2013-07-06T17:23:26.534559+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:260:in `safe_constantize'
←[36m2013-07-06T17:23:26.533565+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:502:in `load_missing_constant'
←[36m2013-07-06T17:23:26.534019+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:190:in `const_missing'
←[36m2013-07-06T17:23:26.534443+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `constantize'
←[36m2013-07-06T17:23:26.535034+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/abstract_controller/railties/routes_helpers.rb:7:in `block (2 levels)
in with'
←[36m2013-07-06T17:23:26.533047+00:00 app[web.1]:←[0m from /app/app/models/member.rb:4:in `<class:Member>'
←[36m2013-07-06T17:23:26.533047+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
←[36m2013-07-06T17:23:26.534224+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in `block in constantize'
←[36m2013-07-06T17:23:26.533047+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
←[36m2013-07-06T17:23:26.533413+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-07-06T17:23:26.534332+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `each'
←[36m2013-07-06T17:23:26.533413+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_load'
←[36m2013-07-06T17:23:26.533921+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:190:in `each'
←[36m2013-07-06T17:23:26.535192+00:00 app[web.1]:←[0m from /app/app/controllers/members_controller.rb:1:in `<top (required)>'
←[36m2013-07-06T17:23:26.538409+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
←[36m2013-07-06T17:23:26.534559+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:152:in `_default_wrap_model'
←[36m2013-07-06T17:23:26.534787+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:169:in `_set_wrapper_default
s'
←[36m2013-07-06T17:23:26.538409+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-07-06T17:23:26.538514+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:225:in `require_dependency'
←[36m2013-07-06T17:23:26.538646+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:438:in `each'
←[36m2013-07-06T17:23:26.534559+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/core_ext/string/inflections.rb:66:in `safe_constanti
ze'
←[36m2013-07-06T17:23:26.535135+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_controller/railties/paths.rb:7:in `block (2 levels) in with'
←[36m2013-07-06T17:23:26.538409+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_load'
←[36m2013-07-06T17:23:26.538646+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:438:in `block in eager_load!'
←[36m2013-07-06T17:23:26.538409+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
←[36m2013-07-06T17:23:26.538514+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:313:in `depend_on'
←[36m2013-07-06T17:23:26.542055+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
←[36m2013-07-06T17:23:26.542152+00:00 app[web.1]:←[0m from config.ru:1:in `new'
←[36m2013-07-06T17:23:26.541993+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
←[36m2013-07-06T17:23:26.542152+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
←[36m2013-07-06T17:23:26.541767+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
←[36m2013-07-06T17:23:26.541993+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
←[36m2013-07-06T17:23:26.542152+00:00 app[web.1]:←[0m from config.ru:3:in `block in <main>'
←[36m2013-07-06T17:23:26.538646+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!'
←[36m2013-07-06T17:23:26.538409+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
←[36m2013-07-06T17:23:26.538646+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:436:in `each'
←[36m2013-07-06T17:23:26.541767+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
←[36m2013-07-06T17:23:26.541993+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
←[36m2013-07-06T17:23:26.542055+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
←[36m2013-07-06T17:23:26.542152+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
←[36m2013-07-06T17:23:26.541890+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
←[36m2013-07-06T17:23:26.542152+00:00 app[web.1]:←[0m from config.ru:3:in `require'
←[36m2013-07-06T17:23:26.538646+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
←[36m2013-07-06T17:23:26.542152+00:00 app[web.1]:←[0m from /app/config/environment.rb:5:in `<top (required)>'
←[36m2013-07-06T17:23:26.542437+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `<main>'
←[36m2013-07-06T17:23:26.542152+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `eval'
←[36m2013-07-06T17:23:26.542437+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:152:in `run!'
←[36m2013-07-06T17:23:26.542152+00:00 app[web.1]:←[0m from config.ru:1:in `<main>'
←[36m2013-07-06T17:23:26.542437+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command'
←[36m2013-07-06T17:23:26.542304+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
←[36m2013-07-06T17:23:26.542152+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `load'
←[36m2013-07-06T17:23:26.542304+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:71:in `start'
←[36m2013-07-06T17:23:26.542437+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `load'
←[36m2013-07-06T17:23:26.542437+00:00 app[web.1]:←[0m from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/bin/thin:6:in `<top (required)>'
←[36m2013-07-06T17:23:27.988495+00:00 heroku[web.1]:←[0m Process exited with status 1
←[36m2013-07-06T17:23:28.000207+00:00 heroku[web.1]:←[0m State changed from starting to crashed
←[32m2013-07-06T17:23:28.664077+00:00 heroku[router]:←[0m at=error code=H10 desc="App crashed" method=GET path=/ host=paradisedkp.herokuapp.com fwd="69.43.65.182" dyno= connect= service=
status=503 bytes=
gemfile
source 'http://rubygems.org'
ruby '1.9.3'
gem 'json', '1.7.7'
gem 'rails', '3.2.8'
group :development, :test do
gem 'mysql2'
end
group :production do
gem 'pg'
gem 'thin'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'heroku'
gem 'bcrypt-ruby', '~> 3.1.0'
gem 'mail'
gem 'will_paginate', '~> 3.0.0'
gem 'rufus-scheduler'
gem 'rails_autolink'
回答1:
Hard to read, but I think the crucial line is this one:
can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.0. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
Try adding it and then re-deploy.
Edit:
Add this line to your Gemfile:
gem 'bcrypt-ruby', '~> 3.1.0'
Then run bundle update bcrypt-ruby
; git add both the Gemfile and the Gemfile.lock and try to re-deploy;
回答2:
You're not crazy - I got the same error, and was able to get things working by replacing gem 'bcrypt-ruby'
with gem 'bcrypt-ruby', '~> 3.0.0'
in my Gemfile.
It seems like something, somewhere is specifying bcrypt-ruby (~> 3.0.0)
- don't know what...
回答3:
When your question was posted (July 6th 2013) Rails secure_password.rb
was using gem 'bcrypt-ruby', '~> 3.0.0'
On July 17th 2013 Rails secure_password.rb
was updated to use gem 'bcrypt-ruby', '~> 3.1.0'
See commit: https://github.com/rails/rails/commit/ad62cf68f89506b0a5074fec8e08d104865aa0ee#L1L47
I don't think you can use gem 'bcrypt-ruby', '~> 3.1.0'
in your Gemfile
until Heroku is using a version of Rails containing the above commit.
To solve your issue:
Use gem 'bcrypt-ruby', '~> 3.0.0'
in your Gemfile
.
Then do bundle install
to update your Gemfile.lock
.
Then git add .
and git commit -m "Using gem bcrypt-ruby ~> 3.0.0"
Finally git push heroku master
来源:https://stackoverflow.com/questions/17505792/keep-getting-application-error-on-heroku