Skip to content

Commit

Permalink
[DOCS] Updates Troubleshooting for adapters information
Browse files Browse the repository at this point in the history
  • Loading branch information
picandocodigo committed Nov 7, 2023
1 parent 3cdf602 commit 81a6c72
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/troubleshooting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,38 @@ When working with multiple hosts, you might want to enable the `retry_on_failure

For optimal performance, use a HTTP library which supports persistent ("keep-alive") connections, such as https://github.com/toland/patron[patron] or https://github.com/typhoeus/typhoeus[Typhoeus]. Require the library (`require 'patron'`) in your code for Faraday 1.x or the adapter (`require 'faraday/patron'`) for Faraday 2.x, and it will be automatically used.

[discrete]
=== Adapter is not registered on Faraday

If you see a message like:
```
:adapter is not registered on Faraday::Adapter (Faraday::Error)
```

Then you probably need to include the adapter library in your Gemfile and require it. You might get this error when migrating from Faraday v1 to Faraday v2. The main change when using Faraday v2 is all adapters, except for the default `net_http` one, have been moved out into separate gems. This means if you're not using the default adapter and you migrate to Faraday v2, you'll need to add the adapter gems to your Gemfile.

These are the gems required for the different adapters with Faraday 2, instead of the libraries on which they were based:

[source,ruby]
------------------------------------
# HTTPCLient
gem 'faraday-httpclient'
# NetHTTPPersistent
gem 'faraday-net_http_persistent'
# Patron
gem 'faraday-patron'
# Typhoeus
gem 'faraday-typhoeus'
------------------------------------

Things should work fine if you migrate to Faraday 2 as long as you include the adapter (unless you're using the default one `net-http`), but worst case scenario, you can always lock the version of Faraday in your project to 1.x:
`gem 'faraday', '~> 1'`

Be aware if migrating to Faraday v2 that it requires at least Ruby `2.6`, unlike Faraday v1 which requires `2.4`.

[discrete]
=== More Help

Expand Down

0 comments on commit 81a6c72

Please sign in to comment.