The oAuth process works fine on Heroku, but I cannot get it to work locally. My app sends a user through the oAuth process, but the callback never makes it to the controller (tested by putting a pry in the create method of the controller it should be reaching). The weird thing is that it used to work locally. I've even reverted back to when it was working to no avail. Any help would be much appreciated!
EDIT: I created a brand new app, and the same problem exists. This must be something with my computer/network. Any ideas?
Terminal
Started GET "/auth/google_oauth2" for ::1 at 2017-03-09 22:38:58 -0700
I, [2017-03-09T22:38:58.613208 #40471] INFO -- omniauth:(google_oauth2) Request phase initiated.
Started GET "/auth/google_oauth2/callback?state=abunchofrandomnumbers&code=morerandomnumbers" for ::1 at 2017-03-09 22:38:59 -0700
I, [2017-03-09T22:38:59.492677 #40471] INFO -- omniauth: (google_oauth2) Callback phase initiated.
Faraday::ConnectionFailed (execution expired)
config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, ENV['youtube_id'], ENV['youtube_secret'], scope: 'userinfo.profile,youtube'
end
routes.rb
get '/auth/:provider/callback', to: 'youtube_users#create'
Gemfile
gem 'rails', '~> 5.0.1'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.5'
gem 'bcrypt', '~> 3.1.7'
gem 'figaro'
gem 'faraday'
gem 'bootstrap-sass'
gem 'yt'
gem 'omniauth-google-oauth2'
gem 'rails-html-sanitizer'
gem 'bootstrap_form'
Google Dev Console Credentials
Origin: http://localhost:3000
Redirect URI: http://localhost:3000/auth/google_oauth2/callback
Image of errors in browser
development.log
Started GET "/auth/google_oauth2" for ::1 at 2017-03-12 00:45:13 -0700
(google_oauth2) Request phase initiated.
Started GET "/auth/google_oauth2/callback?state=ecc60cda112ce1f74a28318ac2f2e148debe8afde204d307&code=4/9aFUvRVFluC7fwiDXkstbjZVoiWj684ViSbObLIfSsQ" for ::1 at 2017-03-12 00:45:16 -0700
(google_oauth2) Callback phase initiated.
Faraday::ConnectionFailed (execution expired):
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:880:in `initialize'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:880:in `open'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:880:in `block in connect'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:878:in `connect'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:852:in `start'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:1398:in `request'
faraday (0.11.0) lib/faraday/adapter/net_http.rb:80:in `perform_request'
faraday (0.11.0) lib/faraday/adapter/net_http.rb:38:in `block in call'
faraday (0.11.0) lib/faraday/adapter/net_http.rb:85:in `with_net_http_connection'
faraday (0.11.0) lib/faraday/adapter/net_http.rb:33:in `call'
faraday (0.11.0) lib/faraday/request/url_encoded.rb:15:in `call'
faraday (0.11.0) lib/faraday/rack_builder.rb:139:in `build_response'
faraday (0.11.0) lib/faraday/connection.rb:377:in `run_request'
oauth2 (1.3.1) lib/oauth2/client.rb:99:in `request'
oauth2 (1.3.1) lib/oauth2/client.rb:146:in `get_token'
oauth2 (1.3.1) lib/oauth2/strategy/auth_code.rb:30:in `get_token'
omniauth-google-oauth2 (0.4.1) lib/omniauth/strategies/google_oauth2.rb:107:in `custom_build_access_token'
omniauth-oauth2 (1.4.0) lib/omniauth/strategies/oauth2.rb:73:in `callback_phase'
omniauth (1.6.1) lib/omniauth/strategy.rb:230:in `callback_call'
omniauth (1.6.1) lib/omniauth/strategy.rb:187:in `call!'
omniauth (1.6.1) lib/omniauth/strategy.rb:167:in `call'
omniauth (1.6.1) lib/omniauth/builder.rb:63:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.2) lib/active_record/migration.rb:553:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.2) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.2) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.2) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.2) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.2) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.2) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.2) lib/rails/engine.rb:522:in `call'
puma (3.8.1) lib/puma/configuration.rb:224:in `call'
puma (3.8.1) lib/puma/server.rb:590:in `handle_request'
puma (3.8.1) lib/puma/server.rb:425:in `process_client'
puma (3.8.1) lib/puma/server.rb:289:in `block in run'
puma (3.8.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Rendering /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (4.1ms)
Rendering /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.9ms)
Rendering /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.7ms)
Rendered /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (95.2ms)
You may want to first check if you have already specified your localhost port and added /oauth2callback in your Developers Console as shown in the image below. See if it works.
Otherwise, check the full documentation of OpenID Connect, wherein it was mentioned in The Discovery document that:
The OpenID Connect protocol requires the use of multiple endpoints for authenticating users, and for requesting resources including tokens, user information, and public keys.
To simplify implementations and increase flexibility, OpenID Connect allows the use of a "Discovery document," a JSON document found at a well-known location containing key-value pairs which provide details about the OpenID Connect provider's configuration, including the URIs of the authorization, token, userinfo, and public-keys endpoints.
With this, you may want to also use the following configuration as given in this GitHub post:
export OAUTH_AUTHORIZATION_URL="https://accounts.google.com/o/oauth2/v2/auth"
export OAUTH_TOKEN_URL="https://www.googleapis.com/oauth2/v4/token"
export OAUTH_USERINFO_URL="https://www.googleapis.com/oauth2/v3/userinfo"
export OAUTH_CLIENT_ID="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.apps.googleusercontent.com"
export OAUTH_CLIENT_SECRET="BBBBBBBBBBBBBBBBBBBBBBBB"
export OAUTH_CALLBACK_URL="http://localhost:7100/auth/oauth/callback"
export OAUTH_SCOPE="openid email"
# Now you can just run stf local without the annoying auth options.
stf local --auth-type oauth
Hope that helps
Related
I want to remove ActionCable from my Rails app, and I found this which says to replace gem rails in the Gemfile with all of rails component gems minus gem 'action_cable'. I did this and I manually removed action cable from gemfile.lock
# gem 'rails', '5.2.0'
gem 'activerecord', '5.2.0'
gem 'activemodel', '5.2.0'
gem 'actionpack', '5.2.0'
gem 'actionview', '5.2.0'
gem 'actionmailer', '5.2.0'
gem 'activejob', '5.2.0'
gem 'activesupport', '5.2.0'
gem 'railties', '5.2.0'
gem 'sprockets-rails'
Gemfile.lock:
rails (5.2.0)
#bye bye action cable
actionmailer (= 5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
activemodel (= 5.2.0)
activerecord (= 5.2.0)
activestorage (= 5.2.0)
activesupport (= 5.2.0)
bundler (>= 1.3.0)
railties (= 5.2.0)
sprockets-rails (>= 2.0.0)
To be on the safe side, I used the very emotionally relevant right now rake assets:clobber command. But when I start my server, the logs indicate that something related to actioncable is still present:
Started GET "/cable" for ::1 at 2020-04-26 17:25:08 -0700
ActionController::RoutingError (No route matches [GET] "/cable"):
actionpack (5.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (5.2.0) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (5.2.0) lib/active_support/tagged_logging.rb:71:in `block in tagged'
activesupport (5.2.0) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (5.2.0) lib/active_support/tagged_logging.rb:71:in `tagged'
railties (5.2.0) lib/rails/rack/logger.rb:26:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
rack-timeout (0.6.0) lib/rack/timeout/core.rb:151:in `block in call'
rack-timeout (0.6.0) lib/rack/timeout/support/timeout.rb:19:in `timeout'
rack-timeout (0.6.0) lib/rack/timeout/core.rb:150:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.2.2) lib/rack/method_override.rb:24:in `call'
rack (2.2.2) lib/rack/runtime.rb:22:in `call'
activesupport (5.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/static.rb:127:in `call'
rack (2.2.2) lib/rack/sendfile.rb:110:in `call'
railties (5.2.0) lib/rails/engine.rb:524:in `call'
puma (4.3.3) lib/puma/configuration.rb:228:in `call'
puma (4.3.3) lib/puma/server.rb:682:in `handle_request'
puma (4.3.3) lib/puma/server.rb:472:in `process_client'
puma (4.3.3) lib/puma/server.rb:328:in `block in run'
puma (4.3.3) lib/puma/thread_pool.rb:134:in `block in spawn_thread'
I even ran gem uninstall action_cable and deleted all versions from my system. Why is it haunting me? ActionCable has turned into an unsolvable hassle.
First thing, if you remove the gem from your gemfile, and run bundle install, it will install only gems from your gemfile and should have updated gemfile.lock, but it will not uninstall gem from your system.
But you have to remove the gem from the system by calling gem install <gemname>.
See this post
ActionCable should be disabled (not removed) in your config/application.rb file:
# config/application.rb
# Comment the below line out to disable ActionCable
require "action_cable/engine"
Users are not able lo login from Facebook since July 3rd.
I'm using omniauth-facebook. I tested login successfully from localhost (pointing to another FB test app). But in production the app shows this error:
Started GET "/auth/facebook" for 190.238.101.80 at 2019-07-10 17:53:51 -0500
I, [2019-07-10T17:53:51.594796 #4707] INFO -- omniauth: (facebook) Request phase initiated.
Started GET "/auth/facebook/callback?code=AQAj5FOJuHu7UY656lbwZ4Sfcf_J_ZX9Z_t0wRT-LDfnPLU530zKj5CNGEK53yJ9maNj8O80fWgGmxCq4zWqBK7CPN-ovokGZVIvfY0KaqzNRXWOC20kH4KhkYOHjPyRh4tMYTIcHZ1a0BvHfbBLVolYECVtfD1OKJ2Xob07LCpS0SHNhYc6PA3rBAnb6GnkvOZI-8S7nwXIICdFoKu0BbHd-6L8_Dq-dPFTOpJDSWgmoJUBc65EyCnuw7NCI4IFP1UtxtOmB_QjuzRQV-voQs_SV6N97c2ICK_Qc-IqL_WBwqd54aEzdnW5UOsDV4Wo0jA&state=cee86047aecb4d282b80d33bbd0469815a17d25566167d95" for 190.238.101.80 at 2019-07-10 17:53:52 -0500
I, [2019-07-10T17:53:52.082829 #4707] INFO -- omniauth: (facebook) Callback phase initiated.
Faraday::ConnectionFailed (execution expired):
/usr/lib/ruby/2.5.0/net/http.rb:937:in `initialize'
/usr/lib/ruby/2.5.0/net/http.rb:937:in `open'
/usr/lib/ruby/2.5.0/net/http.rb:937:in `block in connect'
/usr/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
/usr/lib/ruby/2.5.0/net/http.rb:935:in `connect'
/usr/lib/ruby/2.5.0/net/http.rb:920:in `do_start'
/usr/lib/ruby/2.5.0/net/http.rb:909:in `start'
/usr/lib/ruby/2.5.0/net/http.rb:1458:in `request'
faraday (0.15.4) lib/faraday/adapter/net_http.rb:87:in `perform_request'
faraday (0.15.4) lib/faraday/adapter/net_http.rb:43:in `block in call'
faraday (0.15.4) lib/faraday/adapter/net_http.rb:92:in `with_net_http_connection'
faraday (0.15.4) lib/faraday/adapter/net_http.rb:38:in `call'
faraday (0.15.4) lib/faraday/request/url_encoded.rb:15:in `call'
faraday (0.15.4) lib/faraday/rack_builder.rb:143:in `build_response'
faraday (0.15.4) lib/faraday/connection.rb:387:in `run_request'
oauth2 (1.4.1) lib/oauth2/client.rb:99:in `request'
oauth2 (1.4.1) lib/oauth2/client.rb:146:in `get_token'
oauth2 (1.4.1) lib/oauth2/strategy/auth_code.rb:30:in `get_token'
omniauth-oauth2 (1.6.0) lib/omniauth/strategies/oauth2.rb:89:in `build_access_token'
omniauth-facebook (5.0.0) lib/omniauth/strategies/facebook.rb:110:in `build_access_token'
omniauth-oauth2 (1.6.0) lib/omniauth/strategies/oauth2.rb:73:in `callback_phase'
omniauth-facebook (5.0.0) lib/omniauth/strategies/facebook.rb:67:in `block in callback_phase'
omniauth-facebook (5.0.0) lib/omniauth/strategies/facebook.rb:131:in `with_authorization_code!'
omniauth-facebook (5.0.0) lib/omniauth/strategies/facebook.rb:66:in `callback_phase'
omniauth (1.9.0) lib/omniauth/strategy.rb:238:in `callback_call'
omniauth (1.9.0) lib/omniauth/strategy.rb:189:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/builder.rb:64:in `call'
rack (1.6.11) lib/rack/etag.rb:24:in `call'
rack (1.6.11) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.11) lib/rack/head.rb:13:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.11) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.11) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.8) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.8) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.8) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.8) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.8) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.8) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.8) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.8) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.8) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.11) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.11) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.8) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/static.rb:120:in `call'
rack (1.6.11) lib/rack/sendfile.rb:113:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/ssl.rb:24:in `call'
railties (4.2.8) lib/rails/engine.rb:518:in `call'
railties (4.2.8) lib/rails/application.rb:165:in `call'
rack (1.6.11) lib/rack/content_length.rb:15:in `call'
thin (1.7.2) lib/thin/connection.rb:86:in `block in pre_process'
thin (1.7.2) lib/thin/connection.rb:84:in `catch'
thin (1.7.2) lib/thin/connection.rb:84:in `pre_process'
thin (1.7.2) lib/thin/connection.rb:53:in `process'
thin (1.7.2) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.2.7) lib/eventmachine.rb:195:in `run_machine'
eventmachine (1.2.7) lib/eventmachine.rb:195:in `run'
thin (1.7.2) lib/thin/backends/base.rb:73:in `start'
thin (1.7.2) lib/thin/server.rb:162:in `start'
rack (1.6.11) lib/rack/handler/thin.rb:19:in `run'
rack (1.6.11) lib/rack/server.rb:287:in `start'
railties (4.2.8) lib/rails/commands/server.rb:80:in `start'
railties (4.2.8) lib/rails/commands/commands_tasks.rb:80:in `block in server'
railties (4.2.8) lib/rails/commands/commands_tasks.rb:75:in `tap'
railties (4.2.8) lib/rails/commands/commands_tasks.rb:75:in `server'
railties (4.2.8) lib/rails/commands/commands_tasks.rb:39:in `run_command!'
railties (4.2.8) lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:8:in `require'
bin/rails:8:in `<main>'
I tried creating a test app with Facebook using localhost and it works.
I tried with another app in production with another domain and it works.
It does not work with this particular application in production. I messaged Facebook support, but they don't reply, and days have passed.
I'm using RoR 4.2.8, with Bundler 1.17.3
I tried with ruby-2.5.1 and ruby-2.3.3 just in case (same error)
I tried with another Facebook app with identical settings, using another RoR v5 app with ruby-2.6 and it worked, so the FB app settings seem to be ok.
I created another FB app, to try with the failing RoR v4.2.8 app, and it fails with the same "Faraday::ConnectionFailed (execution expired):" error.
config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, 'APP-ID', 'SECRET',
scope: 'email'
end
Users should be able lo login using Facebook, but it fails with "Faraday::ConnectionFailed (execution expired):"
From what it looks like is you are having a network issue where Faraday isn't set up to wait long enough for a response. All I can really tell from the trace is that somewhere along the trail to facebook and back you're encountering network issues.
A couple of things I can think to check:
If your site is running through HTTPS, ensure your certificate is working properly.
Check that your gemfile is set to require a specific version of omniauth-facebook that is compatible with your version of Rails and dependencies.
Extend the timeout length for Faraday
Use a retry gem like https://github.com/ooyala/retries to try and give the network enough time to respond before Faraday closes the connection.
A few other people have commented on this issue in omniauth-facebook's github https://github.com/mkdynamic/omniauth-facebook/issues/283
I was working on Devise + active storage, need a method ActiveStorage::Blob#open which is available currently only in rails 6 vdersion so upgraded rails 5.2 to rails 6.0.0.alpha. After upgrading I'm getting this error. I tried many solutions but none of them work.
Started GET "/admins/sign_in" for 127.0.0.1 at 2018-06-05 08:23:21 +0530
(1.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
↳ /home/rotlu_crush/.rvm/gems/ruby-2.4.1/gems/activerecord-5.2.0/lib/active_record/log_subscriber.rb:98
ActionController::RoutingError (undefined local variable or method `mimes_for_respond_to' for DeviseController:Class):
devise (4.4.3) app/controllers/devise_controller.rb:18:in `<class:DeviseController>'
devise (4.4.3) app/controllers/devise_controller.rb:4:in `<main>'
bootsnap (1.3.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:100:in `load'
bootsnap (1.3.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:100:in `load'
activesupport (5.2.0) lib/active_support/dependencies.rb:468:in `block in load_file'
activesupport (5.2.0) lib/active_support/dependencies.rb:653:in `new_constants_in'
activesupport (5.2.0) lib/active_support/dependencies.rb:467:in `load_file'
activesupport (5.2.0) lib/active_support/dependencies.rb:365:in `block in require_or_load'
activesupport (5.2.0) lib/active_support/dependencies.rb:37:in `block in load_interlock'
activesupport (5.2.0) lib/active_support/dependencies/interlock.rb:14:in `block in loading'
activesupport (5.2.0) lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
activesupport (5.2.0) lib/active_support/dependencies/interlock.rb:13:in `loading'
activesupport (5.2.0) lib/active_support/dependencies.rb:37:in `load_interlock'
activesupport (5.2.0) lib/active_support/dependencies.rb:348:in `require_or_load'
activesupport (5.2.0) lib/active_support/dependencies.rb:502:in `load_missing_constant'
bootsnap (1.3.0) lib/bootsnap/load_path_cache/core_ext/active_support.rb:43:in `load_missing_constant'
activesupport (5.2.0) lib/active_support/dependencies.rb:193:in `const_missing'
devise (4.4.3) app/controllers/devise/sessions_controller.rb:3:in `<main>'
bootsnap (1.3.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:100:in `load'
bootsnap (1.3.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:100:in `load'
activesupport (5.2.0) lib/active_support/dependencies.rb:468:in `block in load_file'
activesupport (5.2.0) lib/active_support/dependencies.rb:653:in `new_constants_in'
activesupport (5.2.0) lib/active_support/dependencies.rb:467:in `load_file'
activesupport (5.2.0) lib/active_support/dependencies.rb:365:in `block in require_or_load'
activesupport (5.2.0) lib/active_support/dependencies.rb:37:in `block in load_interlock'
activesupport (5.2.0) lib/active_support/dependencies/interlock.rb:14:in `block in loading'
activesupport (5.2.0) lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
activesupport (5.2.0) lib/active_support/dependencies/interlock.rb:13:in `loading'
activesupport (5.2.0) lib/active_support/dependencies.rb:37:in `load_interlock'
activesupport (5.2.0) lib/active_support/dependencies.rb:348:in `require_or_load'
activesupport (5.2.0) lib/active_support/dependencies.rb:502:in `load_missing_constant'
bootsnap (1.3.0) lib/bootsnap/load_path_cache/core_ext/active_support.rb:43:in `load_missing_constant'
activesupport (5.2.0) lib/active_support/dependencies.rb:193:in `const_missing'
activesupport (5.2.0) lib/active_support/inflector/methods.rb:285:in `const_get'
activesupport (5.2.0) lib/active_support/inflector/methods.rb:285:in `block in constantize'
activesupport (5.2.0) lib/active_support/inflector/methods.rb:281:in `each'
activesupport (5.2.0) lib/active_support/inflector/methods.rb:281:in `inject'
activesupport (5.2.0) lib/active_support/inflector/methods.rb:281:in `constantize'
activesupport (5.2.0) lib/active_support/dependencies.rb:574:in `get'
activesupport (5.2.0) lib/active_support/dependencies.rb:605:in `constantize'
actionpack (5.2.0) lib/action_dispatch/http/request.rb:88:in `controller_class_for'
actionpack (5.2.0) lib/action_dispatch/http/request.rb:81:in `controller_class'
actionpack (5.2.0) lib/action_dispatch/routing/route_set.rb:46:in `controller'
actionpack (5.2.0) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.2.0) lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
actionpack (5.2.0) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (5.2.0) lib/action_dispatch/journey/router.rb:52:in `block in serve'
actionpack (5.2.0) lib/action_dispatch/journey/router.rb:35:in `each'
actionpack (5.2.0) lib/action_dispatch/journey/router.rb:35:in `serve'
actionpack (5.2.0) lib/action_dispatch/routing/route_set.rb:840:in `call'
rack-pjax (1.0.0) lib/rack/pjax.rb:12:in `call'
remotipart (1.4.2) lib/remotipart/middleware.rb:32:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.5) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.0.5) lib/rack/etag.rb:25:in `call'
rack (2.0.5) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.5) lib/rack/head.rb:12:in `call'
actionpack (5.2.0) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
rack (2.0.5) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.5) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/cookies.rb:670:in `call'
activerecord (5.2.0) lib/active_record/migration.rb:559:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (5.2.0) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (5.2.0) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
web-console (3.6.2) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.6.2) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.6.2) lib/web_console/middleware.rb:20:in `catch'
web-console (3.6.2) lib/web_console/middleware.rb:20:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (5.2.0) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (5.2.0) lib/active_support/tagged_logging.rb:71:in `block in tagged'
activesupport (5.2.0) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (5.2.0) lib/active_support/tagged_logging.rb:71:in `tagged'
railties (5.2.0) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.5) lib/rack/method_override.rb:22:in `call'
rack (2.0.5) lib/rack/runtime.rb:22:in `call'
activesupport (5.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/static.rb:127:in `call'
rack (2.0.5) lib/rack/sendfile.rb:111:in `call'
railties (5.2.0) lib/rails/engine.rb:524:in `call'
puma (3.11.4) lib/puma/configuration.rb:225:in `call'
puma (3.11.4) lib/puma/server.rb:632:in `handle_request'
puma (3.11.4) lib/puma/server.rb:446:in `process_client'
puma (3.11.4) lib/puma/server.rb:306:in `block in run'
puma (3.11.4) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Gem file:
ruby '2.4.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
# gem 'rails', '~> 5.2.0'
gem "rails", github: "rails/rails"
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
#
gem 'figaro'
gem 'devise'
# gem 'rails_admin', github: 'dtcristo/rails_admin', branch: 'active_storage'
gem 'rails_admin', github: 'dtcristo/rails_admin', branch: 'active_storage'
# gem 'rails_admin'
gem 'rails_admin_rollincode'
# gem "wysiwyg-rails"
gem "activerecord-import"
gem "simple_xlsx_reader"
If any one had same issue, please help to resolve this issue.
responder is a dependency of devise gem and others.
When trying to upgrading Rails (from 5.1.6 to 5.2.1) and Gemfile, somehow the responder gem was downgraded to version 0.6.5 (may be it was related to one of my gem in Gemfile)
Update the responder gem to latest version may fix this. For now it is version 2.4.0 which should work with devise 4.4.3
bundle update responders
Hope this helps!
I'm currently experiencing the failure of bcrypt's encryptor while using Devise for Rails 5.0.1. I never had this issue before with the earlier Rails 4.2. I can't register new users through Devise. I will post information with regards to my gemfile and server log.
Gemfile.rb
gem 'bcrypt', platforms: :ruby
# Devise
gem 'devise'
gem 'devise_security_extension'
gem 'redis'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
Server log
Started POST "/register" for 127.0.0.1 at 2017-01-12 13:50:05 -0500
Processing by Users::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"bH6n7iWLhPMECDzTVkMyTc9FXtvkGrq5+K4wFs1g8Bxbjq9ShaLJP5gn72SFQlHc01j2ao5JKcv57ClWAzwsmw==", "user"=>{"email"=>"craigcarl#codex.com", "username"=>"codex", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
Completed 500 Internal Server Error in 258ms (ActiveRecord: 0.0ms)
LoadError - cannot load such file -- bcrypt_ext:
activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require'
activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `block in require'
activesupport (5.0.1) lib/active_support/dependencies.rb:259:in `load_dependency'
activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require'
bcrypt-3.1.11-x86 (mingw32) lib/bcrypt.rb:16:in `rescue in <top (required)>'
bcrypt-3.1.11-x86 (mingw32) lib/bcrypt.rb:12:in `<top (required)>'
activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require'
activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `block in require'
activesupport (5.0.1) lib/active_support/dependencies.rb:259:in `load_dependency'
activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require'
devise (4.2.0) lib/devise/encryptor.rb:1:in `<top (required)>'
activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require'
activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `block in require'
activesupport (5.0.1) lib/active_support/dependencies.rb:259:in `load_dependency'
activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require'
devise (4.2.0) lib/devise/models/database_authenticatable.rb:147:in `password_digest'
devise (4.2.0) lib/devise/models/database_authenticatable.rb:40:in `password='
activemodel (5.0.1) lib/active_model/attribute_assignment.rb:46:in `public_send'
activemodel (5.0.1) lib/active_model/attribute_assignment.rb:46:in `_assign_attribute'
activemodel (5.0.1) lib/active_model/attribute_assignment.rb:40:in `block in _assign_attributes'
activemodel (5.0.1) lib/active_model/attribute_assignment.rb:39:in `each'
activemodel (5.0.1) lib/active_model/attribute_assignment.rb:39:in `_assign_attributes'
activerecord (5.0.1) lib/active_record/attribute_assignment.rb:26:in `_assign_attributes'
activemodel (5.0.1) lib/active_model/attribute_assignment.rb:33:in `assign_attributes'
activerecord (5.0.1) lib/active_record/core.rb:319:in `initialize'
activerecord (5.0.1) lib/active_record/inheritance.rb:65:in `new'
activerecord (5.0.1) lib/active_record/inheritance.rb:65:in `new'
devise (4.2.0) lib/devise/models/registerable.rb:20:in `new_with_session'
devise (4.2.0) app/controllers/devise/registrations_controller.rb:100:in `build_resource'
devise (4.2.0) app/controllers/devise/registrations_controller.rb:15:in `create'
actionpack (5.0.1) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.0.1) lib/abstract_controller/base.rb:188:in `process_action'
actionpack (5.0.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.0.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.0.1) lib/active_support/callbacks.rb:126:in `call'
activesupport (5.0.1) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
activesupport (5.0.1) lib/active_support/callbacks.rb:455:in `call'
activesupport (5.0.1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.1) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.0.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.1) lib/abstract_controller/base.rb:126:in `process'
actionview (5.0.1) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.1) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.1) lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>'
actionpack (5.0.1) lib/action_dispatch/routing/mapper.rb:46:in `serve'
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
rack (2.0.1) lib/rack/deflater.rb:35:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:38:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.1) lib/active_record/migration.rb:553:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.1) lib/rails/engine.rb:522:in `call'
puma (3.6.2) lib/puma/configuration.rb:225:in `call'
puma (3.6.2) lib/puma/server.rb:578:in `handle_request'
puma (3.6.2) lib/puma/server.rb:415:in `process_client'
puma (3.6.2) lib/puma/server.rb:275:in `block in run'
puma (3.6.2) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
Started POST "/__better_errors/4e4442c3f810d7b9/variables" for 127.0.0.1 at 2017-01-12 13:50:06 -0500
I had a similar problem today with ruby 2.3.3 and rails 4.2.4.
The problem was that bundle install of devise installed as a dependency another version of bcrypt (bcrypt (3.1.11 x86-mingw32) instead of bcrypt (3.1.11)) which was causing trouble with ruby 2.3 (it should work with all previous versions of ruby)
The solution I used is to install bcrypt outside of the gemfile, run bundle and then remove the second version of bcrypt :
$ gem list bcrypt
bcrypt (3.1.11 x86-mingw32)
$ gem uninstall devise && gem uninstall bcrypt
Successfully uninstalled devise-4.2.0
Successfully uninstalled bcrypt-3.1.11-x86-mingw32
$ gem install bcrypt --platform=Ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed bcrypt-3.1.11
Parsing documentation for bcrypt-3.1.11
Installing ri documentation for bcrypt-3.1.11
Done installing documentation for bcrypt after 1 seconds
1 gem installed
$ gem list bcrypt
bcrypt (3.1.11)
$ bundle install
...
Installing bcrypt 3.1.11 (x86-mingw32)
...
Installing devise 4.2.0
Bundle complete! 25 Gemfile dependencies, 75 gems now installed.
$ gem list bcrypt
bcrypt (3.1.11 ruby x86-mingw32)
$ gem uninstall bcrypt
Select gem to uninstall:
1. bcrypt-3.1.11
2. bcrypt-3.1.11-x86-mingw32
3. All versions
> 2
Successfully uninstalled bcrypt-3.1.11-x86-mingw32
$ gem list bcrypt
bcrypt (3.1.11)
Hope that helps if you haven't solved your problem yet.
I also encountered the same problem, then I found some references and it's about version only.
When I changed bcrypt back to
bcrypt 3.1.0-x86-mingw32
from
bcrypt 3.1.11-x86-mingw32(the latest now)
Then make sure again in gemfile
gem 'bcrypt-ruby', '3.1.0', :require => 'bcrypt'
then it works fine.
I also face this same issue for ruby '2.3.3' and rails '5.2.0' but the only solution right now is to run:
gem uninstall bcrypt
gem install bcrypt --platform=ruby
temporary fix.
Maybe it's just the native binary is wrongly built or corrupted. Try below
Open a command console
cd to the gem directory C:\RailsInstaller\Ruby2.2.0\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x86-mingw32\ext\mri
Run ruby extconf.rb. It should create the Makefile
Run make. It will builde the extension libraries.
Run make install
See more at Fix issue "cannot load such file -- bcrypt_ext (LoadError)"
These steps to fix issue in MS Win 10 and 8
Uninstall all bcrypt
gem uninstall bcrypt
Go on lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/lib/ and copy bcrypt_ext.so file. and paste on desktop for now.
Uninstall all bcrypt again
gem uninstall bcrypt
Add in your project's gemfile
gem 'bcrypt', '~> 3.1.7'
Run commands
bundle install
bundle update
Paste copied bcrypt_ext.so in folder lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/lib/ from desktop.
Restart server
rails server
It works on win 7 and 10!!!
I have been developing using rails 4 and ruby 1.9.3, I was using the twitter bootstrap tutorial from http://railscasts.com/episodes/328-twitter-bootstrap-basics and I am getting the following error now trying to load my app, can anyone help with this, I have tried variations of get "welcome/index" and root to: 'welcome#index' in my route.rb file.
Here are my welcome controller, framework trace, routes.rb and gem file:
Error message: ArgumentError in Rails::WelcomeController#index
/////Framework trace
actionpack (4.0.0) lib/abstract_controller/base.rb:89:in `initialize'
actionpack (4.0.0) lib/abstract_controller/base.rb:89:in `new'
actionpack (4.0.0) lib/abstract_controller/base.rb:89:in `action_methods'
actionpack (4.0.0) lib/action_controller/metal/hide_actions.rb:36:in `action_methods'
actionpack (4.0.0) lib/abstract_controller/url_for.rb:25:in `action_methods'
actionpack (4.0.0) lib/abstract_controller/base.rb:179:in `action_method?'
actionpack (4.0.0) lib/abstract_controller/base.rb:230:in `method_for_action'
actionpack (4.0.0) lib/action_controller/metal/hide_actions.rb:17:in `method_for_action'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:14:in `method_for_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:130:in `process'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__159494264__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
/////////Routes.rb
Myapp::Application.routes.draw do
devise_for :users
#get "welcome/index"
root to: 'welcome#index'
end
/////////Welcome controller
class WelcomeController < ApplicationController
def index
end
end
////////Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
#gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
gem "paperclip", :git => "git://github.com/thoughtbot/paperclip.git"
gem 'protected_attributes'
gem 'will_paginate'
gem 'devise'
gem 'cancan'
gem 'less-rails'
gem 'twitter-bootstrap-rails'
gem 'therubyracer'
#gem 'libv8'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# group :assets do
# gem 'twitter-bootstrap-rails'
# end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
I don't have problems with twitter bootstrap, running in Ruby 2.0.
You can try in Ruby 2.0.