SSL_connect (Errno::ECONNRESET) - ruby

We have UI automation test framework based on cucumber. Recently we have moved from Ruby 1.9.x to 2.2.0 and after that we are facing problem in login to our application via test framework. It says SSL connect reset problem.
Error Trace:
07:01:26 An existing connection was forcibly closed by the remote host. - SSL_connect (Errno::ECONNRESET)
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient/ssl_socket.rb:46:in `connect'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient/ssl_socket.rb:46:in `ssl_connect'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient/ssl_socket.rb:24:in `create_socket'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:739:in `block in connect'
07:01:26 D:/Ruby223/lib/ruby/2.2.0/timeout.rb:88:in `block in timeout'
07:01:26 D:/Ruby223/lib/ruby/2.2.0/timeout.rb:98:in `call'
07:01:26 D:/Ruby223/lib/ruby/2.2.0/timeout.rb:98:in `timeout'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:735:in `connect'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:497:in `query'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:170:in `query'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient.rb:1238:in `do_get_block'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient.rb:1021:in `block in do_request'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient.rb:1129:in `protect_keep_alive_disconnected'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient.rb:1016:in `do_request'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient.rb:858:in `request'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/httpclient-2.7.1/lib/httpclient.rb:761:in `post'
<-- our Code for login kick in to call httpclient --->
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/lib/cucumber/rb_support/rb_language.rb:96:in `load'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/lib/cucumber/rb_support/rb_language.rb:96:in `load_code_file'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/lib/cucumber/runtime/support_code.rb:142:in `load_file'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/lib/cucumber/runtime/support_code.rb:84:in `block in load_files!'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/lib/cucumber/runtime/support_code.rb:83:in `each'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/lib/cucumber/runtime/support_code.rb:83:in `load_files!'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/lib/cucumber/runtime.rb:254:in `load_step_definitions'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/lib/cucumber/runtime.rb:62:in `run!'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/lib/cucumber/cli/main.rb:32:in `execute!'
07:01:26 D:/Ruby223/lib/ruby/gems/2.2.0/gems/cucumber-2.3.2/bin/cucumber:8:in `<top (required)>'

I had the same issue a while back after moving to ruby 2.0.0
Follow the following steps to solve it
1)Visit the url http://curl.haxx.se/ca/cacert.pem save the contents as a .pem file(Do not save it as a text file.Make sure the extension is .pem)
2)Copy the file to any path in your local eg: C:\ruby200\ca_cert.pem (in my case)
3)Now add an Environment variable with Variable SSL_CERT_FILE and value "C:\ruby200\ca_cert.pem"(without quotes)(path is in my case.Replace with appropriate path)
(Environment variables can be added by navigating to Computer -> Advanced Settings -> Environment Variables)
4)Close all your command prompts and restart them.Things should work fine now

I think your gem is updated.Add these lines in your code to solve the problem
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
before http.use_ssl = true
I hope this might solve the problem.

Related

Sinatra app deployment to Heroku fails

It's a simple 2 page Sinatra app and Heroku returns the following error messages.
I tried placing config.ru and app.rb below app folder and root path
but both did not work...
Am I missing something?
2018-03-22T18:40:51.490531+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `load'
2018-03-22T18:40:51.490533+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `<top (required)>'
2018-03-22T18:40:53.657577+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 22470`
2018-03-22T18:40:55.804338+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T18:40:55.821099+00:00 heroku[web.1]: State changed from starting to crashed
2018-03-22T18:40:55.675952+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.4.0/bin/rackup)
2018-03-22T18:40:55.675970+00:00 app[web.1]: LoadError: cannot load such file -- ./app
2018-03-22T18:40:55.675972+00:00 app[web.1]: /app/config.ru:1:in `require'
2018-03-22T18:40:55.675973+00:00 app[web.1]: /app/config.ru:1:in `block in <main>'
2018-03-22T18:40:55.675974+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `instance_eval'
2018-03-22T18:40:55.675976+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `initialize'
2018-03-22T18:40:55.675977+00:00 app[web.1]: /app/config.ru:in `new'
2018-03-22T18:40:55.675978+00:00 app[web.1]: /app/config.ru:in `<main>'
2018-03-22T18:40:55.675980+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `eval'
2018-03-22T18:40:55.675981+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `new_from_string'
2018-03-22T18:40:55.675983+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:40:in `parse_file'
2018-03-22T18:40:55.675985+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:319:in `build_app_and_options_from_config'
2018-03-22T18:40:55.675986+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:219:in `app'
2018-03-22T18:40:55.675988+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:354:in `wrapped_app'
2018-03-22T18:40:55.675990+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:283:in `start'
2018-03-22T18:40:55.675991+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:148:in `start'
2018-03-22T18:40:55.675993+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/bin/rackup:4:in `<top (required)>'
2018-03-22T18:40:55.675995+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `load'
2018-03-22T18:40:55.675997+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `<top (required)>'
2018-03-22T18:44:05.000000+00:00 app[api]: Build succeeded
2018-03-22T18:44:40.562559+00:00 heroku[web.1]: State changed from crashed to starting
2018-03-22T18:44:42.586913+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 5319`
2018-03-22T18:44:45.148047+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T18:44:45.168235+00:00 heroku[web.1]: State changed from starting to crashed
2018-03-22T18:44:45.025605+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.4.0/bin/rackup)
2018-03-22T18:44:45.025629+00:00 app[web.1]: LoadError: cannot load such file -- sinatra/link_header
2018-03-22T18:44:45.025631+00:00 app[web.1]: /app/app/app.rb:2:in `require'
2018-03-22T18:44:45.025632+00:00 app[web.1]: /app/app/app.rb:2:in `<top (required)>'
2018-03-22T18:44:45.025634+00:00 app[web.1]: /app/config.ru:1:in `require'
2018-03-22T18:44:45.025635+00:00 app[web.1]: /app/config.ru:1:in `block in <main>'
2018-03-22T18:44:45.025637+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `instance_eval'
2018-03-22T18:44:45.025638+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `initialize'
2018-03-22T18:44:45.025641+00:00 app[web.1]: /app/config.ru:in `<main>'
2018-03-22T18:44:45.025640+00:00 app[web.1]: /app/config.ru:in `new'
2018-03-22T18:44:45.025642+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `eval'
2018-03-22T18:44:45.025644+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `new_from_string'
2018-03-22T18:44:45.025646+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:40:in `parse_file'
2018-03-22T18:44:45.025647+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:319:in `build_app_and_options_from_config'
2018-03-22T18:44:45.025649+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:219:in `app'
2018-03-22T18:44:45.025651+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:354:in `wrapped_app'
2018-03-22T18:44:45.025652+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:283:in `start'
2018-03-22T18:44:45.025654+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:148:in `start'
2018-03-22T18:44:45.025655+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/bin/rackup:4:in `<top (required)>'
2018-03-22T18:44:45.025657+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `load'
2018-03-22T18:44:45.025659+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `<top (required)>'
2018-03-22T19:04:36.398574+00:00 heroku[web.1]: Restarting
2018-03-22T19:04:36.399250+00:00 heroku[web.1]: State changed from up to starting
2018-03-22T19:04:37.265389+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-03-22T19:04:37.446567+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T19:04:37.288342+00:00 app[web.1]: [4] - Gracefully shutting down workers...
2018-03-22T19:04:37.301303+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.4.0/bin/rackup)
2018-03-22T19:04:37.301330+00:00 app[web.1]: SignalException: SIGTERM
2018-03-22T19:04:37.301336+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/cluster.rb:381:in `block in setup_signals'
2018-03-22T19:04:37.301338+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/cluster.rb:475:in `select'
2018-03-22T19:04:37.301339+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/cluster.rb:475:in `run'
2018-03-22T19:04:37.301340+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/launcher.rb:183:in `run'
2018-03-22T19:04:37.301341+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/rack/handler/puma.rb:69:in `run'
2018-03-22T19:04:37.301343+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:297:in `start'
2018-03-22T19:04:37.301344+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:148:in `start'
2018-03-22T19:04:37.301345+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/bin/rackup:4:in `<top (required)>'
2018-03-22T19:04:37.301347+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `load'
2018-03-22T19:04:37.301392+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `<top (required)>'
2018-03-22T19:04:38.773020+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 16845`
2018-03-22T19:04:40.529326+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T19:04:40.538335+00:00 heroku[web.1]: State changed from starting to crashed
2018-03-22T19:04:40.541186+00:00 heroku[web.1]: State changed from crashed to starting
2018-03-22T19:04:40.428727+00:00 app[web.1]: configuration /app/config.ru not found
2018-03-22T19:04:42.516252+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 3071`
2018-03-22T19:04:44.810385+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T19:04:44.823666+00:00 heroku[web.1]: State changed from starting to crashed
2018-03-22T19:04:44.653840+00:00 app[web.1]: configuration /app/config.ru not found
I just made the test, wrote a very simple Sinatra app and pushed it to Heroku.
Gemfile
source 'https://rubygems.org'
ruby '2.4.0'
gem 'sinatra'
config.ru
require './app'
run Sinatra::Application
app.rb
require 'sinatra'
get '/' do
"Hello world"
end
Launching rackup locally worked perfectly at this point, but when I pushed to heroku, I got an error as well, just like you. Looks like I was missing a Procfile. I then added a simple Procfile to tell Heroku what should be launched when running the app:
Procfile
web: bundle exec rackup config.ru -p $PORT
So at this point, I got this file hierarchy:
App directory
\
|– Gemfile
|– config.ru
|– app.rb
|– Procfile
And voilà, it now works perfectly. It might be worth giving it a shot and add this kind of Procfile to your project. You can find more details about Procfile on Heroku Getting started on Heroku with Ruby : Procfile and their devcenter article about process types and Procfiles.

Puppet with apache and passenger: Could not spawn process for application

I get the following error in apache log on puppet master:
Any ideas what could be wrong here:
[ E 2018-03-11 07:50:58.9057 10913/T8 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is cd3585fe. Please see earlier logs for details about the error.
App 10950 stdout:
App 10950 stdout:
[ E 2018-03-11 07:51:03.0922 10913/Te age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/puppet/rack/puppetmasterd: An error occurred while starting up the preloader.
Error ID: 01cd04d1
Error details saved to: /tmp/passenger-error-sAcbhg.html
Message from application: cannot load such file -- puppet/util/command_line (LoadError)
/usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
config.ru:32:in `block in <main>'
/usr/local/rvm/gems/ruby-2.4.1/gems/rack-2.0.4/lib/rack/builder.rb:55:in `instance_eval'
/usr/local/rvm/gems/ruby-2.4.1/gems/rack-2.0.4/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.2.1/src/helper-scripts/rack-preloader.rb:110:in `eval'
/usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.2.1/src/helper-scripts/rack-preloader.rb:110:in `preload_app'
/usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.2.1/src/helper-scripts/rack-preloader.rb:156:in `<module:App>'
/usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.2.1/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.2.1/src/helper-scripts/rack-preloader.rb:29:in `<main>'
My config:
Centos 6.5,
Puppet 3.8.7,
Apache/2.2.15,
Phusion Passenger 5.2.1

Attempting to open https sites in ruby using open-uri gives ssl issue.. How do i resolve?

Dug through a lot of documentation and tried monkey patching. Not sure how to force proper certs, nor where to get them. everything works fine with regular http pages. Using Ruby 1.9.3
Here is stacktrace:
C:/Ruby193/lib/ruby/1.9.1/net/http.rb:800:in `connect': SSL_connect returned=1 e
rrno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL
::SSL::SSLError)
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:800:in `block in connect'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:800:in `connect'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:306:in `open_http'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:776:in `buffer_open'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:203:in `block in open_loop'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:201:in `catch'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:201:in `open_loop'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:146:in `open_uri'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:678:in `open'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:33:in `open'
When trying to use the open-uri call open you can pass an option to not verify the SSL.
page = Nokogiri::HTML(open(url,{ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}))

invalid css on rails app Michael Hartl tutorial

I just finished chapter five of the Mike Hartle rails tutorial and was a little confused when I loaded my files to heroku and the css for whatever reason was not working its magic like it was for me localy. Here is a copy of my heroku logs if that helps at all.
2013-09-17T00:40:31.225391+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-09-17T00:40:31.225544+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-09-17T00:40:31.225544+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-17T00:40:31.225544+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-09-17T00:40:31.359182+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=fathomless-earth-8911.herokuapp.com fwd="66.235.48.7" dyno=web.1 connect=1ms service=4ms status=304 bytes=0
2013-09-17T00:40:31.225689+00:00 app[web.1]:
2013-09-17T00:40:31.225689+00:00 app[web.1]:
2013-09-17T00:40:31.225689+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/images/rails.png"):
2013-09-17T00:40:31.225689+00:00 app[web.1]:
2013-09-17T00:40:31.225689+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:38:in `call_app'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `block in call'
2013-09-17T00:40:31.225689+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-09-17T00:40:31.225689+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-09-17T00:40:31.226188+00:00 app[web.1]:
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-17T00:40:31.226188+00:00 app[web.1]:
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
I ran into the same issue (using Windows 7). I found that the question was only partially answered by Heijmans above. Hartl isn't very specific about why or how this error occurs but does address the issue in section 2.3.5 and the end of the intro to Chapter 3.
Mine worked after the following process.
First, I ran
> heroku run bundle exec rake assets:precompile
> heroku open
But I still got errors. Then I followed Hartl's suggestion in the book in the following manner.
> git add .
> git commit -m "Add precompiled assets for Heroku"
> git push
> git push heroku master
> heroku run rake db:migrate
> heroku open
Interestingly, Hartl states that "This shouldn’t be necessary, and I have been unable to reproduce the issue, but the reports are common enough that I include it here for reference."
[tag: heroku]
[tag: railstutorial.org]
[tag: Windows 7]
[tag: Rails 4]
In Production the asset pipeline will kick in and your app will look for the precompiled version of the assets. I'm not familiar with that tutorial but I am assuming because this is the leading cause of css and javascript not available in production (heroku). There are 2 ways you can fix this...
The first way is to precompile your assets on heroku by running the precompile command from your app's directory:
heroku run bundle exec rake assets:precompile
The second way (not suggested) is to turn of the asset pipeline by commenting these lines out in your config/environments/production.rb file:
# Do not fallback to assets pipeline if a precompiled asset is missed.
# config.assets.compile = false
You may also want to turn off digests for your asset urls if you are disabling your precompiled assets
# Generate digests for assets URLs.
# config.assets.digest = true

Ruby Mechanize https error

I'm trying to do the following:
page = Mechanize.new.get "https://sis-app.sph.harvard.edu:9030/prod/bwckschd.p_disp_dyn_sched"
But I only get this exception:
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert illegal parameter
from /Users/amosng/.rvm/gems/ruby-1.9.3-p194/gems/net-http-persistent-2.7/lib/net/http/persistent/ssl_reuse.rb:70:in `connect'
from /Users/amosng/.rvm/gems/ruby-1.9.3-p194/gems/net-http-persistent-2.7/lib/net/http/persistent/ssl_reuse.rb:70:in `block in connect'
from /Users/amosng/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
from /Users/amosng/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from /Users/amosng/.rvm/gems/ruby-1.9.3-p194/gems/net-http-persistent-2.7/lib/net/http/persistent/ssl_reuse.rb:70:in `connect'
from /Users/amosng/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from /Users/amosng/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:750:in `start'
from /Users/amosng/.rvm/gems/ruby-1.9.3-p194/gems/net-http-persistent-2.7/lib/net/http/persistent.rb:511:in `connection_for'
from /Users/amosng/.rvm/gems/ruby-1.9.3-p194/gems/net-http-persistent-2.7/lib/net/http/persistent.rb:806:in `request'
from /Users/amosng/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.5.1/lib/mechanize/http/agent.rb:258:in `fetch'
from /Users/amosng/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.5.1/lib/mechanize.rb:407:in `get'
from (irb):549
from /Users/amosng/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
How can I get the webpage to load in Mechanize?
Sometimes you need to tell mechanize to use sslv3:
page = Mechanize.new{|a| a.ssl_version, a.verify_mode = 'SSLv3', OpenSSL::SSL::VERIFY_NONE}.get "https://sis-app.sph.harvard.edu:9030/prod/bwckschd.p_disp_dyn_sched"
Notice that I use OpenSSL::SSL::VERIFY_NONE. That means you are theoretically vulnerable to man-in-the-middle attack, but that's not something I generally worry about when I'm scraping a website.

Resources