I have followed the pandastream setup docs on Heroku, available here https://devcenter.heroku.com/articles/pandastream
However when using heroku run console and executing Panda::Profile.all I get
irb(main):001:0> Panda::Profile.all
NoMethodError: undefined method `connection' for nil:NilClass
from /app/vendor/bundle/ruby/1.9.1/gems/panda-1.5.0/lib/panda/modules/cloud_connection.rb:4:in `connection'
from /app/vendor/bundle/ruby/1.9.1/gems/panda-1.5.0/lib/panda/modules/finders.rb:19:in `find_object_by_path'
from /app/vendor/bundle/ruby/1.9.1/gems/panda-1.5.0/lib/panda/modules/finders.rb:23:in `find_by_path'
from /app/vendor/bundle/ruby/1.9.1/gems/panda-1.5.0/lib/panda/modules/finders.rb:44:in `all'
from (irb):1
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Testing it locally works fine with the intended results. Any ideas?
Some sanity checks
Did you create the file config/initializers/panda.rb as given in guide for initializer?
Run heroku addons:open pandastream & verify your S3 bucket and credentials. a wrong credential will most likely lead to connection error like you are seeing in your stack trace
try update to the latest version of typhoeus & panda to see if that helps
Hope it helps. And don't forget to Post back, if none of this helps.
Related
I have just cloned a github repo https://github.com/maxitron93/p2pcollective.com, as i was exploring this awesome p2p lending app i encountered an error
NoMethodError: undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::PostgreSQLColumn:Class
both when migrationg db or raunning server. I'm using the cloud9 ide to avoid my pc environment.
Running through a couple of solution posts, i updated my gem store with device and erubis but still returned back to that 'alias_method_chain' error.
Here's a snippet of my logs:
rake db:migrate
rake aborted!
NoMethodError: undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::PostgreSQLColumn:Class
Did you mean? alias_method
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:80:in `<class:PostgreSQLColumn>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:74:in `<module:ConnectionAdapters>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:70:in `<module:ActiveRecord>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:2:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:256:in `block in load_dependency'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:662:in `new_constants_in'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:256:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/railties.rb:18:in `block (2 levels) in <class:Hstore>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
I expect my rails server to run smoothly from here.
alias_method_chain was deprecated and removed in Rails 5, but existed prior to that. It looks like a dependency (possibly pg) that has been installed is incompatible. You may be able to resolve the issue with bundle update pg, and if not, a broader bundle update should do the trick.
EDIT:
This is what I get for internet'ing before coffee. The gem responsible is in your stacktrace: activerecord-postgres-hstore, which isn't in the project you linked to, which suggests you've made other changes. You don't need that gem for Rails 4+. More info here
In my case, I had gem 'foreigner package from Gemfile
gem uninstall foreigner
bundle install
rails db:migrate
I hope it will be helpfull
I Installed PGbouncer to help with transaction pooling, and so far it seems to be helping. However, when I do heroku run console my connection does not have access to ActiveRecord or any models.
NameError: uninitialized constant ActiveRecord
from (irb):8
from /app/vendor/bundle/ruby/2.3.0/gems/countries-2.1.2/bin/console:14:in `<top (required)>'
from /app/vendor/bundle/bin/console:17:in `load'
from /app/vendor/bundle/bin/console:17:in `<main>'
irb(main):011:0> User
NameError: uninitialized constant User
from (irb):11
from /app/vendor/bundle/ruby/2.3.0/gems/countries-2.1.2/bin/console:14:in `<top (required)>'
from /app/vendor/bundle/bin/console:17:in `load'
from /app/vendor/bundle/bin/console:17:in `<main>'
Solved by instead using
heroku run rails console
Had always used heroku run console up to this point. Could be useful information for people who have this problem in the future.
I'm just starting a new rails app but it doesn't let me start the server, after typing 'rails s' the console just pukes me out this;
/Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x007fa393f7db20> (NoMethodError)
from /Users/user/Desktop/MiProyecto/Portafolio/config/application.rb:12:in `<class:Application>'
from /Users/user/Desktop/MiProyecto/Portafolio/config/application.rb:10:in `<module:Portafolio>'
from /Users/user/Desktop/MiProyecto/Portafolio/config/application.rb:9:in `<top (required)>'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:78:in `require'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:9:in `require'
from bin/rails:9:in `<main>'
Any thoughts?
Thanks in advance.
ps: I already ran bundle install and it went out perfectly.
Check in which Rails version you started your application. If by any chance you changed it, upgrading or downgrading it, then, just to be sure, try removing the Gemfile.lock file, adding the "original" Rails version and bundling again.
I reproduced the 'method_missing': undefined method 'load_defaults' error firstly creating a blank Rails application using the 5.1.3 version, and then changing it to the 5.0.1, removing the Gemfile.lock and running bundle.
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.
I'm a beginner with Rails and I've been trying to find out what in the world is going wrong here for the past few days but with absolutely no luck. I searched everywhere, but found nothing. Basically, when I run any sort of command line method, I will get a NameError. I have tried running this in different project directories as well that used to work. It seems that rails is just broken...
I am running Win7-32bit using NetBeans 6.9.1 for editing files and cmd.exe for running rails console.
Everything had been working fine for about two weeks and then this started happening suddenly. Here are a few examples:
rails generate model:
irb(main):004:0> rails generate model datatest
NameError: undefined local variable or method `datatest' for main:Object
from (irb):4
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
rails generate migration:
irb(main):003:0> rails generate migration rename_password_to_hashed_password
NameError: undefined local variable or method `rename_password_to_hashed_password' for main:Object
from (irb):3
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
rake db:migrate:
irb(main):005:0> rake db:migrate
NameError: undefined local variable or method `migrate' for main:Object
from (irb):5
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Any sort of help would be VERY appreciated. Thanks!
These commands don't work from within irb, you have to start them directly from cmd.exe.
I would take the initiative of elaborating #dhofset's answer. Basically we use rails app related commands in the console directly and not in the irb console. Even I work on windows so I give you this with few examples
This is what you do
1. Create new App
C:\Users\rohit>rails new_app
2. Generate a scaffold
C:\Users\rohit\new_app>ruby script\generate scaffold User name:string
3. Generate a model
C:\Users\rohit\new_app>ruby script\generate model User name:string
4. To run a rake task
C:\Users\rohit\new_app>rake db:create
C:\Users\rohit\new_app>rake db:migrate
Hope you have a better understanding now.
Yep, dhofstet has it right: these are all commands for the windows prompt, they're not ruby statements.