From 81a6c724f4dab50e30d25c96ed7a5ede53346b72 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Mon, 6 Nov 2023 14:53:28 +0000 Subject: [PATCH] [DOCS] Updates Troubleshooting for adapters information --- docs/troubleshooting.asciidoc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/troubleshooting.asciidoc b/docs/troubleshooting.asciidoc index 9b889f51bd..72bd0891b1 100644 --- a/docs/troubleshooting.asciidoc +++ b/docs/troubleshooting.asciidoc @@ -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