elixir-plug/plug_cowboy

Response cookies must be set using cowboy_req

robkane1 opened this issue · 8 comments

Howdy,

I just ran a new mix phx.create today and it is broken out of the box. On initial load you see the following error:

{:response_error, :invalid_header, :"Response cookies must be set using cowboy_req:set_resp_cookie/3,4."}

I went down a bit of a rabbit hole trying to get it to work, but luckily had created a new project a couple of days ago which worked and still works fine.

Seems Cowboy has released an update today (2.11) and that doesn't play nice with plug_cowboy, which asks for the latest cowboy (from what I can see). So todays build running with 2.11 doesn't work, but the build with 2.10 works fine.

Problem is that Cowboy isn't an explicit dependency for a new Phoenix project, plug_cowboy is. So we can't downgrade the Cowboy version to a working one.

Thank you! I have released Plug Cowboy v2.7 and there will be a new Phoenix release soon. You can either force {:plug_cowboy, "~> 2.7"} or add {:cowboy, "~> 2.10.0"}.

Awesome! Thank you for the speedy response :)

Any idea why my tests wouldn't catch this? I didn't get this error until I bumped my deps, all tests passed and then it took down prod.

Regular tests do not go through the actual socket, since the goal of Plug is to abstract the web server. It is just a very unfortunate case where a package did a breaking change. :( You would need to have integration tests to catch it (or give it a try in dev).

Rings a bell i didnt try it in dev. Just had full faith in my tests 🤣. I'll be sure to do that, thanks

Is there going to be a 2.8.0 soon?

2.7.1 is out.

Awesome, thank you @josevalim always coming through!