PSPDFKit-labs / bypass

Bypass provides a quick way to create a custom plug that can be put in place instead of an actual HTTP server to return prebaked responses to client requests.
https://hex.pm/packages/bypass
MIT License
964 stars 111 forks source link

Error initializing bypass #123

Closed tfwright closed 2 years ago

tfwright commented 2 years ago

Following the docs, trying to install bypass for the first time in a Phoenix project:

# mix.ex
{:bypass, "~> 2.1", only: :test}

# test

setup do
  bypass = Bypass.open()
end

But I run into this error:

     ** (RuntimeError) Failed to start bypass instance.
     Reason: bad child specification, got: {{:badmap, [{:raw, 1, 15, <<1, 0, 0, 0>>}, {:ip, {127, 0, 0, 1}}, {:port, 0}]}, [{:maps, :get, [:logger, [{:raw, 1, 15, <<1, 0, 0, 0>>}, {:ip, {127, 0, 0, 1}}, {:port, 0}], :logger], [file: 'maps.erl', line: 188]}, {:ranch_tcp, :listen, 1, [file: '/app/deps/ranch/src/ranch_tcp.erl', line: 92]}, {Bypass.Instance, :init, 1, [file: 'lib/bypass/instance.ex', line: 28]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 417]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 385]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}

I feel like I must be missing something obvious but I can't figure out what.

tfwright commented 2 years ago

This is due to using Ranch 2.1, which appears to be incompatible with bypass currently. Downgrading to Ranch 1.8 fixes