elixir-plug / plug_cowboy

Plug adapter for the Cowboy web server
Other
243 stars 48 forks source link

Response cookies must be set using cowboy_req #95

Closed robkane1 closed 8 months ago

robkane1 commented 8 months ago

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.

josevalim commented 8 months ago

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"}.

robkane1 commented 8 months ago

Awesome! Thank you for the speedy response :)

atomkirk commented 8 months ago

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.

josevalim commented 8 months ago

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).

atomkirk commented 7 months ago

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

Ch4s3 commented 6 months ago

Is there going to be a 2.8.0 soon?

josevalim commented 6 months ago

2.7.1 is out.

Ch4s3 commented 6 months ago

Awesome, thank you @josevalim always coming through!