From 525dc095b44cdc9e51df74a5c9e3ffc56fda9b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Sat, 7 Feb 2026 14:14:38 +0100 Subject: [PATCH] Fix Sentry HTTP client and Store behaviour warning Sentry.FinchClient does not exist in sentry 11.x. Add a custom Finch-based HTTP client implementing the Sentry.HTTPClient behaviour. Also remove duplicate list/2 callback from Store.Repo since it is already defined in Store.Docs, fixing conflicting behaviours warning. --- config/config.exs | 2 +- lib/hexdocs/sentry_client.ex | 21 +++++++++++++++++++++ lib/hexdocs/store/store.ex | 1 - 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 lib/hexdocs/sentry_client.ex diff --git a/config/config.exs b/config/config.exs index 3d1c8b2..ff1b64f 100644 --- a/config/config.exs +++ b/config/config.exs @@ -46,7 +46,7 @@ config :ex_aws, http_client: ExAws.Request.Req, json_codec: JSON -config :sentry, client: Sentry.FinchClient +config :sentry, client: Hexdocs.SentryClient config :logger, :console, format: "[$level] $metadata$message\n" diff --git a/lib/hexdocs/sentry_client.ex b/lib/hexdocs/sentry_client.ex new file mode 100644 index 0000000..578a527 --- /dev/null +++ b/lib/hexdocs/sentry_client.ex @@ -0,0 +1,21 @@ +defmodule Hexdocs.SentryClient do + @behaviour Sentry.HTTPClient + + @impl true + def child_spec do + Supervisor.child_spec({Finch, name: __MODULE__}, id: __MODULE__) + end + + @impl true + def post(url, headers, body) do + request = Finch.build(:post, url, headers, body) + + case Finch.request(request, __MODULE__) do + {:ok, %Finch.Response{status: status, headers: headers, body: body}} -> + {:ok, status, headers, body} + + {:error, error} -> + {:error, error} + end + end +end diff --git a/lib/hexdocs/store/store.ex b/lib/hexdocs/store/store.ex index 2cda2ac..b07a2d7 100644 --- a/lib/hexdocs/store/store.ex +++ b/lib/hexdocs/store/store.ex @@ -15,7 +15,6 @@ defmodule Hexdocs.Store do @type opts :: Keyword.t() @callback get(bucket, key, opts) :: body | nil - @callback list(bucket, prefix) :: [key] end defmodule Docs do