How do I fix problems as explained by: TLS connections fail with OTP-24 (in one project only)?
I get timeout errors from the client when trying to access the server, and since I have also seen the same error I believe it to be the same problem.
The suggested solution is to upgrade ranch:
mix deps.get
Resolving Hex dependencies...
Failed to use "ranch" (version 2.0.0) because
cowboy (version 2.9.0) requires 1.8.0
mix.exs specifies ~> 2.0
** (Mix) Hex dependency resolution failed, change the version requirements of your dependencies or unlock them (by using mix deps.update or mix deps.unlock). If you are unable to resolve the conflicts you can try overriding with {:dependency, "~> 1.0", override: true}
But that fails. I believe I have the latest version of plug_cowboy (2.5.0) which depends on the latest version of cowboy (2.9.0) which depends on an outdated version of ranch (1.8.0), which doesn’t work with erlang 24.
I tried adding the required override, but the server won’t even start then.
22:43:24.122 [info] Application robotica_face exited: RoboticaFace.Application.start(:normal, []) returned an error: shutdown: failed to start child: RoboticaFaceWeb.Endpoint
** (EXIT) an exception was raised:
** (MatchError) no match of right hand side value: %{id: {:ranch_embedded_sup, RoboticaFaceWeb.Endpoint.HTTP}, start: {:ranch_embedded_sup, :start_link, [RoboticaFaceWeb.Endpoint.HTTP, :ranch_tcp, %{max_connections: 16384, num_acceptors: 100, socket_opts: [port: 4000, ip: {0, 0, 0, 0, 0, 0, 0, 0}]}, :cowboy_clear, %{env: %{dispatch: [{:_, [], [{:_, [], Phoenix.Endpoint.Cowboy2Handler, {RoboticaFaceWeb.Endpoint, []}}]}]}, stream_handlers: [:cowboy_telemetry_h, :cowboy_stream_h]}]}, type: :supervisor}
(plug_cowboy 2.4.1) lib/plug/cowboy.ex:207: Plug.Cowboy.child_spec/1
(phoenix 1.5.8) lib/phoenix/endpoint/cowboy2_adapter.ex:84: Phoenix.Endpoint.Cowboy2Adapter.child_spec/3
(phoenix 1.5.8) lib/phoenix/endpoint/cowboy2_adapter.ex:64: anonymous fn/5 in Phoenix.Endpoint.Cowboy2Adapter.child_specs/2
(elixir 1.12.1) lib/enum.ex:2356: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix 1.5.8) lib/phoenix/endpoint/cowboy2_adapter.ex:55: Phoenix.Endpoint.Cowboy2Adapter.child_specs/2
(phoenix 1.5.8) lib/phoenix/endpoint/supervisor.ex:106: Phoenix.Endpoint.Supervisor.init/1
(stdlib 3.15.1) supervisor.erl:330: :supervisor.init/1
(stdlib 3.15.1) gen_server.erl:423: :gen_server.init_it/2
Which looks like cowboy is expecting a tuple, but ranch is providing a map.
How do I fix? Downgrade to Erlang 23? Any other options?