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

Failure while closing HTTP connection #59

Open
shiroyasha opened this issue May 31, 2024 · 3 comments
Open

Failure while closing HTTP connection #59

shiroyasha opened this issue May 31, 2024 · 3 comments

Comments

@shiroyasha
Copy link

First of all, excellent work on this library.
Thank you for investing your time an energy into it. 🙇

I've been trying to set it up for our project, but I'm hitting a problem that I either don't understand, or it is a bug.

It is connected to this line in the API client: https://github.com/sasa1977/site_encrypt/blob/master/lib/site_encrypt/http_client.ex#L50.

Here is what happens:

  1. I start a local development server
  2. The local ACME server boots up
  3. site_encrypt tries to create a new account
  4. It runs HttpClient.request
  5. Everything works as expected (I've verified this by adding exhaustive IO.inspects to https://github.com/sasa1977/site_encrypt/blob/master/lib/site_encrypt/http_client.ex#L40-L49)
  6. And then the request fails on line 50 where it tries to close the connection (again)

Here is how it looks on my machine:

Screenshot 2024-05-31 at 19 58 33

If I comment out the Mint.HTTP.close line in the after block, everything works as expected, no errors, and the certs are successfully generated.

Based on these experiments, my conclusion is that the additional Mint.HTTP.close is not necessary for the happy path, but I can't explain why no one else is getting this error, only me.


If it helps, I'm using site_encrypt on a phoenix based project with the following versions:

  • Phoenix 1.7.12
  • Cowboy 2.12.0

PR for setting up site encrypt on our project for reference: https://github.com/operately/operately/pull/500/files.

@sasa1977
Copy link
Owner

sasa1977 commented Jun 4, 2024

I think upgrading Mint to 1.5.1 should fix this problem. See https://github.com/elixir-mint/mint/blob/main/CHANGELOG.md#v151. Can you give it a try?

@shiroyasha
Copy link
Author

shiroyasha commented Jun 4, 2024

It works 🎉

I've run:

mix deps.unlock mint
mix deps.get

After which the server started without a problem and generated a local SSL cert:

✲ NEWDEV ~/code/operately (site-encrypt) ./devenv mix phx.server
14:32:45.297 [info] Running OperatelyWeb.Endpoint with cowboy 2.12.0 at 0.0.0.0:4000 (http)
14:32:45.338 [info] Running OperatelyWeb.Endpoint with cowboy 2.12.0 at 0.0.0.0:4001 (https)
14:32:45.341 [info] Access OperatelyWeb.Endpoint at https://localhost:4001
14:32:45.343 [info] Running local ACME server at port 4002
0.14.54
14:32:45.431 [info] Certificate for localhost is valid until 3023-10-02. Next renewal is scheduled for 3023-09-02.

@sasa1977 what is your suggestion what should we do with the issue, should we close it, or do you want to keep it open?

@sasa1977
Copy link
Owner

sasa1977 commented Jun 4, 2024

Since this is a bug in mint 1.5.0, that is easily fixed in the client project by bumping the mint version, I'm closing the issue.

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

Successfully merging a pull request may close this issue.

2 participants