Unable to get Forest running (httpclient & undefined method `ssl_config')

Feature(s) impacted

Initial loading of Forest. This is the first time I am trying to use forest and am setting up on development in Rails.

Observed behavior

Also noted in Missing httpclient dependency? causing server crash · Issue #585 · ForestAdmin/forest-rails · GitHub

After installing forest_ilana without adding httpclient gem to my Gemfile. My server fails on boot:

helpkitchen $ rails s
=> Booting Puma
=> Rails 7.0.4 application starting in development 
=> Run `bin/rails server --help` for more startup options
Exiting
/Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require': cannot load such file -- httpclient (LoadError)
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/forest_liana-7.6.14/config/initializers/httpclient.rb:1:in `<main>'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:667:in `load'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:667:in `block in load_config_initializer'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:208:in `instrument'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:666:in `load_config_initializer'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:619:in `each'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:619:in `block in <class:Engine>'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:32:in `run'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:50:in `each'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:50:in `tsort_each_child'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:415:in `call'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:415:in `each_strongly_connected_component_from'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `call'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/application.rb:372:in `initialize!'
	from /Users/katelyn/workspace/helpkitchen/config/environment.rb:7:in `<main>'
	from config.ru:5:in `require_relative'
	from config.ru:5:in `block in <main>'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/builder.rb:116:in `eval'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/builder.rb:116:in `new_from_string'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/builder.rb:105:in `load_file'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/builder.rb:66:in `parse_file'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:249:in `app'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:422:in `wrapped_app'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:36:in `start'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:143:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:134:in `perform'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/katelyn/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:6:in `<main>'

If I add httpclient to my Gemfile I am able to get the server running but am still unable to connect to it via Forest:

Unable to authenticate you
Please verify that your admin backend is correctly configured and running.

Expected behavior

I expect that I am able to connect to my server.

Failure Logs

{"errors":[{"status":500,"detail":"undefined method `ssl_config' for #\u003cFaraday::Connection:0x00000001111709c8 @parallel_manager=nil, @headers={\"User-Agent\"=\u003e\"Rack::OAuth2 (2.2.0)\"}, @params={}, @options=#\u003cFaraday::RequestOptions (empty)\u003e, @ssl=#\u003cFaraday::SSLOptions (empty)\u003e, @default_parallel_manager=nil, @manual_proxy=false, @builder=#\u003cFaraday::RackBuilder:0x000000011116ba68 @adapter=Faraday::Adapter::NetHttp, @handlers=[Faraday::Request::UrlEncoded, Faraday::Request::Json, Faraday::Response::Json]\u003e, @url_prefix=#\u003cURI::HTTP http:/\u003e, @proxy=nil\u003e\n\n          config.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE\n                ^^^^^^^^^^^"}]}

Context

  • Project name: HelpKitchen-dev
  • Team name: …
  • Environment name: …
  • Agent type & version: forest_liana (7.7.0)
  • Recent changes made on your end if any: first install
  • Rails - 7.0.4
  • Ruby - ruby 3.1.2p20

Hi @katelyn , and welcome to our community :wave:

I managed to reproduce the bug on my side.

It looks like the issue comes from the openid_connect gem in version >=2.0

I open a ticket on our board and come back to you.

Thank you. I am able to now workaround this for the time being by adding the following to my gemfile:

gem 'openid_connect', '~> 1'

incase anyone needs a way around this until it is fixed.

I just released the new version 7.7.1 of our gem to fix the problem.

As I said earlier, the bug comes from the openid_connect gem.
I have fixed the version of this gem that we use to avoid any bug when a client wants to onboard with our agent.

You can run the following command

bundle update forest_liana

Let me known if the fix works for you :slight_smile:

1 Like