Phoenix: cowboy error on every HTTP request

[error] Ranch protocol :error (:cowboy_protocol) of listener UrlFetcher.Endpoint.HTTP terminated
** (exit) :undef
15:07:19.288 [error] Ranch listener ‘Elixir.UrlFetcher.Endpoint.HTTP’ connection process start failure; cowboy_protocol:start_link/4 crashed with reason: error:undef

Any idea where to look? I have renamed some files & modules, which is of course an immediate suspect for this error. But I’ve double-checked everything; deleted the _build folder; and I don’t see anything wrong in the project.

(I have added gRPC modules; but I don’t see how they could affect this.)

Huh, that is entirely new to me. Any chance on posting this project on github or preferably a simplified version that reproduces this error?

Going through my changes step-by-step: it’s caused by the Cowboy branch from Tony Han as part of his gRPC support.

So I’m going to dig into that repo and look at his commits now.

  • gRPC requires a forked branch of a pre-release of Cowboy 2
  • Cowboy 2 has some API changes which are not compatible with Phoenix
  • There are forks of phoenix & plug with preliminary support for Cowboy 2

The plug/phoenix forks do not work with the gRPC stuff straight out of the box, and I don’t think I can take the time right now to fix that.

I’m trying to implement a super-simple API (1 call), so I think my best bet is probably to start with gRPC, then set up routing of my 1 endpoint from Cowboy to a handler, without Phoenix & Plug.

Oh I hope that adds HTTP2 support… >.<

We need a way in phoenix to specify to the plug to send other data/files to the client along with the page (page first though) ahead-of-time…

Yes, Cowboy 2 adds HTTP2 support, and that is in fact the source of the API incompatibility–new HTTP features.

1 Like

Hi, just saw this. I just use the commit in this PR to support Trailers in HTTP/2 . But I don’t think it’s related to your problem. And maybe it’s not a good idea to use Cowboy2 with Phoenix before the stable version is released.

What’s the status of cowboy 2.x with phoenix? I’m trying to use your grpc library in a phoenix 1.3 project, getting "ranch protocol :error"s.

Current Plug/Phoenix master has Cowboy2 support, they are just finishing refining it but you can use it now if you want to play with it.

1 Like

How exactly should they all be specified in mix.exs?

Use the master versions, they have not had a release yet.