Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Finch warning after update to 0.17 #167

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

brosquinha
Copy link
Contributor

Finch, Goth's HTTP client, has just released a new version that deprecates its protocol option in favor of protocols (more details on this decision can be found here). Consequently, once Finch is updated to this new version, the following runtime warning is emitted:

warning: :protocol option is deprecated. Use :protocols instead.
  (nimble_options 1.1.0) lib/nimble_options.ex:572: NimbleOptions.validate_value/3
  (nimble_options 1.1.0) lib/nimble_options.ex:558: NimbleOptions.validate_option/3
  (nimble_options 1.1.0) lib/nimble_options.ex:540: NimbleOptions.reduce_options/2
  (elixir 1.15.7) lib/enum.ex:4830: Enumerable.List.reduce/3
  (elixir 1.15.7) lib/enum.ex:2564: Enum.reduce_while/3
  (nimble_options 1.1.0) lib/nimble_options.ex:533: NimbleOptions.validate_options/2

So, if simply updating Goth's dependency on Finch from version 0.9 to 0.17 is acceptable, then simply updating deps/goth/lib/goth/application.ex fixes the issue. However, Finch is commonly used in various other libraries, so I'm not sure if this approach is desirable, as many dependents projects might not be able to update it. In any case, let me know what you think.

@@ -6,7 +6,7 @@ defmodule Goth.Application do
def start(_type, _args) do
children = [
{Registry, keys: :unique, name: Goth.Registry},
{Finch, name: Goth.Finch, pools: %{default: [protocol: :http1]}},
{Finch, name: Goth.Finch, pools: %{default: [protocols: [:http1]]}},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http1 is the default, we can just drop the :pools option and it will work across all Finch versions. I don't know if there was a particular reason to use HTTP/1. If anything we could probably assume Google uses HTTP/2 but I wouldn't switch to :http2.

Could you drop :pools options here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, I noticed that we're setting the default explicitly here, and since I don't know the reasoning behind that, didn't want to change it right away, as all I'm trying to do is fix a runtime warning. But if it is ok to drop it, absolutely no problem, done 👍

@wojtekmach wojtekmach merged commit 972bf98 into peburrows:master Jan 11, 2024
2 checks passed
@wojtekmach
Copy link
Collaborator

Thank you!

wisq pushed a commit to wisq/goth that referenced this pull request Jan 14, 2024
@dvic
Copy link

dvic commented Jan 15, 2024

@wojtekmach any chance of cutting a new release? If not, no worries, I'll bump my projects to use the git version.

@wojtekmach
Copy link
Collaborator

v1.4.3 is out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants