Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response cookies must be set using cowboy_req #95

Closed
robkane1 opened this issue Jan 29, 2024 · 8 comments
Closed

Response cookies must be set using cowboy_req #95

robkane1 opened this issue Jan 29, 2024 · 8 comments

Comments

@robkane1
Copy link

robkane1 commented Jan 29, 2024

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.

@whatyouhide whatyouhide changed the title New phoenix build not working New Phoenix build not working Jan 29, 2024
@josevalim
Copy link
Member

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

@josevalim josevalim pinned this issue Jan 29, 2024
@robkane1
Copy link
Author

Awesome! Thank you for the speedy response :)

@josevalim josevalim changed the title New Phoenix build not working Response cookies must be set using cowboy_req Jan 29, 2024
@atomkirk
Copy link

atomkirk commented Feb 6, 2024

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
Copy link
Member

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
Copy link

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
Copy link

Ch4s3 commented Apr 2, 2024

Is there going to be a 2.8.0 soon?

@josevalim
Copy link
Member

2.7.1 is out.

@Ch4s3
Copy link

Ch4s3 commented Apr 3, 2024

Awesome, thank you @josevalim always coming through!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants