devise-1.5.1/lib/devise/omniauth/config.rb:40:in `autoload_strategy': Could not find a strategy with name `Facebook'

Created on 24 Nov 2011  路  6Comments  路  Source: heartcombo/devise

Hi guys I have update my gem devise to 1.5.1, and when I trying run server mongrel I get this error:

Exiting
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.5.1/lib/devise/omniauth/config.rb:40:in autoload_strategy': Could not find a strategy with nameFacebook'. Please ensure it is required or explicitly set it using the :klass option. (Devise::OmniAuth::StrategyNotFound)
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.5.1/lib/devise/omniauth/config.rb:25:in strategy_class' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.5.1/lib/devise/rails.rb:22:inblock (2 levels) in class:Engine'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.5.1/lib/devise/rails.rb:21:in each' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.5.1/lib/devise/rails.rb:21:inblock in class:Engine'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:25:in instance_exec' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:25:inrun'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:50:in block in run_initializers' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:49:ineach'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:49:in run_initializers' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application.rb:92:ininitialize!'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in method_missing' from /home/ubuntu/Desktop/REPAIR/config/environment.rb:5:in from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in require' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inblock in require'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in block in load_dependency' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:innew_constants_in'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in load_dependency' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inrequire'
from /home/ubuntu/Desktop/REPAIR/config.ru:4:in block in <main>' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:51:ininstance_eval'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:51:in initialize' from /home/ubuntu/Desktop/REPAIR/config.ru:1:innew'
from /home/ubuntu/Desktop/REPAIR/config.ru:1:in <main>' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:40:ineval'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:40:in parse_file' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/server.rb:200:inapp'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/server.rb:46:in app' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/server.rb:301:inwrapped_app'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/server.rb:252:in start' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/server.rb:70:instart'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:54:in block in <top (required)>' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:49:intap'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:49:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

Most helpful comment

I had fixed the problem :D.

Add following gem to Gemfile
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'omniauth-github'

Thanks Jos茅 Im from spain :D name Jos茅 is spanish

El 24/11/2011 14:26, Jos茅 Valim escribi贸:

You need to be sure it is loaded. You need to require the relevant files. As in require "omniauth-facebook" for example.


Reply to this email directly or view it on GitHub:
https://github.com/plataformatec/devise/issues/1459#issuecomment-2864489

All 6 comments

As the message says: it could not find a strategy with name Facebook. Be sure you have required it, for example, adding a require "omniauth-facebook" on top of your initializers may help. If not, pass the option directly using :strategy_class.

Thank you Jos茅 I have checked with

_config.omniauth :facebook, "APP_ID", "APP_SECRET", :strategy_class =>
OmniAuth::Strategies::Facebook_

but not working. I get the next error:

Exiting
/home/ubuntu/Desktop/REPAIR/config/initializers/devise.rb:201:in block in <top (required)>': uninitialized constant OmniAuth::Strategies::Facebook (NameError) from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.5.1/lib/devise.rb:252:in setup'
from /home/ubuntu/Desktop/REPAIR/config/initializers/devise.rb:3:in
<top (required)>' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/engine.rb:555:in block (2 levels) in class:Engine'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/engine.rb:554:in
each' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/engine.rb:554:in block in class:Engine'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:25:in
instance_exec' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:25:in run'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:50:in
block in run_initializers' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:49:in each'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/initializable.rb:49:in
run_initializers' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application.rb:92:in initialize!'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in
method_missing' from /home/ubuntu/Desktop/REPAIR/config/environment.rb:5:in (required)>'
from /home/ubuntu/Desktop/REPAIR/config.ru:4:in block in <main>' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:51:in instance_eval'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:51:in
initialize' from /home/ubuntu/Desktop/REPAIR/config.ru:1:innew'
from /home/ubuntu/Desktop/REPAIR/config.ru:1:in <main>' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:40:in eval'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:40:in
parse_file' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/server.rb:200:in app'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/server.rb:46:in
app' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/server.rb:301:in wrapped_app'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/server.rb:252:in
start' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/server.rb:70:in start'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:54:in
block in <top (required)>' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:49:in tap'
from
/home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:49:in
<top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

Thank you

El 24/11/2011 12:47, Jos茅 Valim escribi贸:

As the message says: it could not find a strategy with name Facebook. Be sure you have required it, for example, adding a require "omniauth-facebook" on top of your initializers may help. If not, pass the option directly using :strategy_class.


Reply to this email directly or view it on GitHub:
https://github.com/plataformatec/devise/issues/1459#issuecomment-2861631

You need to be sure it is loaded. You need to require the relevant files. As in require "omniauth-facebook" for example.

I had fixed the problem :D.

Add following gem to Gemfile
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'omniauth-github'

Thanks Jos茅 Im from spain :D name Jos茅 is spanish

El 24/11/2011 14:26, Jos茅 Valim escribi贸:

You need to be sure it is loaded. You need to require the relevant files. As in require "omniauth-facebook" for example.


Reply to this email directly or view it on GitHub:
https://github.com/plataformatec/devise/issues/1459#issuecomment-2864489

I got the same problem and could solve for this issue. Thanks!

Thank you so much for posting the solution. After struggling for 7 hrs, i landed on this page and found the resolution. Thanks once again!!

Was this page helpful?
0 / 5 - 0 ratings