honeybadger-io / honeybadger-elixir

Elixir client for Honeybadger.
MIT License
180 stars 55 forks source link

HTTP client options #467

Open danschultzer opened 1 year ago

danschultzer commented 1 year ago

I've experienced issues with honeybadger not working in a IPv6 only network. This is due to a long running issue in hackney of how IP addresses are resolved: https://github.com/benoitc/hackney/issues/206 (in particular this logic).

Looking at how honeybadger deals with HTTP it would be good to:

  1. Allow options to be passed to hackney (this won't solve my particular issue though edit: should work)
  2. Allow option to chose HTTP client a. Switch to a flexible library like Tesla b. Add an abstraction in honeybadger (this is how I handle it in https://github.com/pow-auth/assent/tree/main/lib/assent to support built-in httpc by default)

A third option, which is about solving the IPv6 issue, is to switch to something other than hackney since upstream fix seems unlikely to happen anytime soon. I solved my issue by switching to Finch and pass in conn_opts: https://github.com/danschultzer/honeybadger-elixir/commit/14bdbe21f6ea754c335478ccb82bb6fa312993a7

sorentwo commented 1 year ago

@danschultzer Thanks for opening this issue; it's something I've thought about a lot recently. An adapter that uses httpc by default, with an easy switch to finch, is perfect.

@joshuap I'll take this one.

danschultzer commented 1 year ago

Sounds great @sorentwo, thanks for looking at this!

I did make a quick PR in #468 to pass hackney opts which solves part of the issue. But it would be nice to just pass in an adapter to deal with edge cases and have more control over the connection egress.

Just a warning on :httpc that the cert check has to be handled explicitly (not built-in 😞). But apart from that and no HTTP/2 support, it works fine, and the benefit is that it helps limit the dependency graph size.