WeAreFarmGeek / diplomat

A HTTP Ruby API for Consul
BSD 3-Clause "New" or "Revised" License
370 stars 116 forks source link

Faraday 2.0.0 breaks diplomat #223

Closed fquesnel closed 2 years ago

fquesnel commented 2 years ago

In short: faraday 2.0.0 now requires to specify an adapter.

Currently, calling Datacenter::get results in the following error message:

An attempt to run a request with a Faraday::Connection without adapter has been made. Please set Faraday.default_adapter or provide one when initializing the connection. For more info, check https://lostisland.github.io/faraday/usage/.

Example stacktrace:

/bundle/ruby/2.7.0/gems/faraday-2.0.0/lib/faraday/rack_builder.rb:230:in 'ensure_adapter!' /bundle/ruby/2.7.0/gems/faraday-2.0.0/lib/faraday/rack_builder.rb:166:in 'app' /bundle/ruby/2.7.0/gems/faraday-2.0.0/lib/faraday/rack_builder.rb:153:in 'build_response' /bundle/ruby/2.7.0/gems/faraday-2.0.0/lib/faraday/connection.rb:445:in 'run_request' /bundle/ruby/2.7.0/gems/faraday-2.0.0/lib/faraday/connection.rb:200:in 'get' /bundle/ruby/2.7.0/gems/diplomat-2.6.0/lib/diplomat/rest_client.rb:253:in 'send_get_request' /bundle/ruby/2.7.0/gems/diplomat-2.6.0/lib/diplomat/datacenter.rb:13:in 'get'

Known mitigation: use faraday <= 1.8.0

pierresouchay commented 2 years ago

@fquesnel Do you think you might provide a patch to support both?

pierresouchay commented 2 years ago

@fquesnel Issue fixed, released version 2.6.1 that enforce Faraday < 2.x If you want to support Faraday 2.x, feel free to provide a PR!

Thanks for reporting the issue

fquesnel commented 2 years ago

@pierresouchay thank you for quickly fixing the issue :slightly_smiling_face:

pierresouchay commented 2 years ago

Since https://github.com/lostisland/faraday/blob/main/CHANGELOG.md#201-2022-01-05 has been released with https://github.com/lostisland/faraday/pull/1366, diplomat can now rely again on Faraday 2.0.1+