Unable to run console on Heroku - ruby-on-rails

I'm trying to deploy my app on a Heroku server, but for some reason I can neither start my app nor run console. When I try to execute heroku run console, I get the following:
MacBook:threexortwo lander$ heroku run console
Running `console` attached to terminal... up, run.1
Rubber[ERROR]: Unable to read rubber configuration from /app/config/rubber/rubber.yml
(erb):301:in `<main>': undefined local variable or method `rubber_env' for main:Object (NameError)
from /usr/local/lib/ruby/1.9.1/erb.rb:753:in `eval'
from /usr/local/lib/ruby/1.9.1/erb.rb:753:in `result'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/environment.rb:39:in `read_config'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/environment.rb:30:in `block in initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/environment.rb:30:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/environment.rb:30:in `initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:37:in `new'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:37:in `initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:14:in `new'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:14:in `get_configuration'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:22:in `rubber_env'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber.rb:53:in `config'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber.rb:31:in `initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/railtie.rb:9:in `block in <class:Railtie>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:34:in `call'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:67:in `inherited'
from /app/config/application.rb:13:in `<module:Threexortwo>'
from /app/config/application.rb:12:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:39:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Previously, I was playing with an Amazon EC2 server, and was using rubber. Before doing anything with rubber, I created a backup (pretty much just zipped the project), then afterwards deleted the vulcanized version, restored the old one, and uninstalled `rubber. When I run my server app locally, I don't encounter this issue, and I only get it when messing with Heroku.

It looks like rubber is still in your gemfile. Heroku reads in your gemfile and installs all of the gems listed.
Try removing it.

Related

Rails - Ruby 3.1.1 will not load on CentOS but okay on OSX

I have a rails app that runs fine on my development iMac (Ventura). I pushed to production CentOS7. It bundled up fine but when trying to to assets precompile I get the error below. I have tried, removing lock file and re-bundling, updating bundler, did gem update and did yum update on server. I get the following when doing rake assets:clean precompile and I see similar error in apache log as well. I am running rails 7.0.4.2 and ruby 3.1.1. I need some guidance on how to resolve.
rake assets:clean precompile
rake aborted!
LoadError: cannot load such file -- Version
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
/admin/bin/rails/catering_bk/config/initializers/active_admin.rb:290:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-3.1.1/gems/activeadmin-2.13.1/lib/active_admin.rb:68:in `setup'
/admin/bin/rails/catering_bk/config/initializers/active_admin.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:667:in `load'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:667:in `block in load_config_initializer'
/usr/local/rvm/gems/ruby-3.1.1/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:208:in `instrument'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:666:in `load_config_initializer'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:619:in `each'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:619:in `block in <class:Engine>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in `run'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:50:in `each'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:50:in `tsort_each_child'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:372:in `initialize!'
/admin/bin/rails/catering_bk/config/environment.rb:5:in `<top (required)>'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:348:in `require_environment!'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:511:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-3.1.1/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
/usr/local/rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `eval'
/usr/local/rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
As noted above. I tried
Remove lock file and bundle again.
gem update
yum update
Also to note this is also an older app that was upgraded to be in compliance with Veracode. It works perfectly on OSX, so the issue must be within CentOS.

Why are my Heroku pipeline review apps failing to build with the error: ActiveSupport::EncryptedFile::MissingKeyError

I am using Heroku Pipeline. My staging app is the parent app for my review apps so the environment variables are the same.
My staging app builds every time, no issues there. But, all of my review apps fail to build. The issue seems to be that the review app is missing the encryption key.
I've run heroku config:set RAILS_MASTER_KEY=##### -a my-app-staging-pr-99 to set the master key for the review app, but I still get the same build error.
Note:
- I'm using Rails 5.2.3 with credentials
- I have config.read_encrypted_secrets = true in my production.rb
- I have my `secret_key_base set in my credentials.yml
See the logs below:
Logs:
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
ActiveSupport::EncryptedFile::MissingKeyError: Missing encryption key to decrypt file with. Ask your team for your master key and write it to /tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/config/master.key or put it in the ENV['RAILS_MASTER_KEY'].
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb:96:in `handle_missing_key'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb:37:in `key'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb:41:in `read'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb:21:in `read'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb:33:in `config'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb:38:in `options'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/delegation.rb:271:in `method_missing'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/config/environments/production.rb:102:in `block in <main>'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/railtie.rb:216:in `instance_eval'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/railtie.rb:216:in `configure'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/config/environments/production.rb:1:in `<main>'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:602:in `block (2 levels) in <class:Engine>'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:601:in `each'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:601:in `block in <class:Engine>'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `each'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `tsort_each_child'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/config/environment.rb:5:in `<main>'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
/tmp/build_0ef8f846f0fdc1456a3e91ed8dc095e6/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app.
! Push failed
app.json
{
"scripts": {
"postdeploy": "rails db:migrate"
}
}
I've been trying to fix this issue for weeks now and I've not been able to figure it out. I'm a newbie, so I apologise if I've missed something obvious here.
One way would be to Add RAILS_MASTER_KEY to environment variables of
your staging app. Then in your review apps, you can inherit it from
staging app.
Generate the key by executing
rake secret
in your project directory
You can use the following command to set the config variable on your staging app
heroku config:set RAILS_MASTER_KEY=<KEY GENERATED BY rake secret> -a my-app-staging
Now in your app.json, you can add
"env": {
"RAILS_MASTER_KEY": {
"required": true
}
In this way, every newly created review app will take its RAILS_MASTER_KEY from staging app.
Hope it helps.

rails - running production mode locally = No such file to load - config/environment

I am trying to run locally in production mode with:
$ RAILS_ENV=production rails s
But I get:
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/li
b/active_support/dependencies.rb:306:in `rescue in depend_on': No such file
to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../con
fig/environment (LoadError)
I can create a brand new rails 3.1.8 app and do RAILS_ENV=production rails server and I don't get this problem.
I can also do rails s and that runs the server fine in development mode without error.
I can also do RAILS_ENV=development rails s and that runs the server fine in development mode without error.
fwiw, my app was originally a rails 2.3 app so perhaps I am missing something that's been added or changed in rails ?
I do have the config directory with an environment.rb file. Perhaps the way it's being referenced is wrong somehow?
I added config.assets.enabled = true to config/application.rb but it didn't help (didn't expect it to as that is asset compilation, but it was a difference I found!).
Full Trace:
durrantm#Castle2012:~/Dropnot/webs/rails_apps/linker/config/environments (v3.1.8_with_assets)
$ RAILS_ENV=production rails s
=> Booting WEBrick
=> Rails 3.1.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:306:in `rescue in depend_on': No such file to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../config/environment (LoadError)
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:301:in `depend_on'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:214:in `require_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:417:in `block (2 levels) in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `block in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application/finisher.rb:51:in `block in <module:Finisher>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `instance_exec'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `run'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application.rb:96:in `initialize!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config/environment.rb:5:in `<top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `block in require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:4:in `block in <main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `new'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `<main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `parse_file'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:200:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:46:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:301:in `wrapped_app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:252:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:70:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:54:in `block in <top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `tap'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Changed a few things. One of the main ones were to enable static assets locally in config/environments/production.rb when trying to run it locally (only) and revert that before pushing to a production web server. I didn't know that.
seems like your old assets directory lived in other place (maybe in public) and now it is in app/assets, but it doesn't know about it and some files try to load environment.rb. just double check assets dir.

Error: uninitialized constant Sprockets::Helpers when pushing to Heroku

I just installed carrierwave and have set my rails 4 app up to store images on Amazon s3 through fog. The app was working and deploying to Heroku with Carrierwave (but images were getting purged with dyno). After some initial issues I got it working on my localhost (as far as I could tell).
Now I am having trouble pushing the new version to Heroku. I have reset the DATABASE. Precompiled the assets and now trying to migrate the database. Below is the error I'm getting.
Running `rake db:migrate` attached to terminal... up, run.6517
rake aborted!
uninitialized constant Sprockets::Helpers
/app/app/uploaders/image_uploader.rb:12:in `<class:ImageUploader>'
/app/app/uploaders/image_uploader.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:347:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/app/config/environment.rb:5:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment
I have tried to include and not include Sprockets in the Uploader file and get the same error either way. I understand that Sprockets is no longer included in the master for Rails 4. I have now installed the sprockets-rails and sprockets-helper gems. I have also tried to require them at the top of the file (I don't understand this completely, but following this suggestion https://github.com/petebrowne/sprockets-helpers). Nothing has worked. Any suggestions about how I can go about resolving this. How do I initialize Sprockets::Helpers. Thanks.
I was making a pretty silly mistake. I had corrected files in my app and as committing the changes to the master, but I kept running the heroku run rake db:migrate command and getting the same error, so I didn't think I have resolved it yet. I had forgotten to push the new version to heroku! Hence the reason for still getting the same error.
Also, in case anyone else has a similar issue. Make sure you have fixed this:
https://github.com/carrierwaveuploader/carrierwave/issues/1020

uninitialized constant when migrating rails from ubuntu to osx

i'm trying to move my rails app from ubuntu to osx. when running rspec, i get the following obscure error:
/Users/josh/dev/myproject/spec/support/devise.rb:3:in `block in <top (required)>': uninitialized constant RequestHelpers (NameError)
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core.rb:92:in `configure'
from /Users/josh/dev/myproject/spec/support/devise.rb:1:in `<top (required)>'
from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `block (2 levels) in <top (required)>'
from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `each'
from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `block in <top (required)>'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/spork-0.9.2/lib/spork.rb:24:in `prefork'
from /Users/josh/dev/myproject/spec/spec_helper.rb:4:in `<top (required)>'
from /Users/josh/dev/myproject/spec/controllers/comments_controller_spec.rb:1:in `require'
from /Users/josh/dev/myproject/spec/controllers/comments_controller_spec.rb:1:in `<top (required)>'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:66:in `rescue in run'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:62:in `run'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
everything works nicely in Ubuntu, so i guess it must be environmental. Any ideas where to start digging?
thanks
- Josh
EDIT: no idea why, but the file request_helpers.rb could not be found by rake. moving it elsewhere resolved the issue.
This hardly seems an operating system problem, much rather a matter of configuration. Make sure your environemnt is the same in terms of:
using rvm installed the same way
having all the needed gems in the Gemfile
using bundle to execute rspec
using the same version of everything.
By te way this is not an obscure message, it's in fact pretty clear:
uninitialized constant RequestHelpers (NameError)
so the spec/support/devise.rb file can't find the needed class.
Have you written that file? If not, how did you generate it? Repeat the procedure to generate it (probably rake something or rails generate something) and it will be OK.

Resources