I just setup a new phoenix app, which is quite empty and installed Tesla
in it with a very basic setup
{:tesla, "~> 1.4"},
{:jason, "~> 1.2"},
{:hackney, "~> 1.17"}
config :tesla, adapter: Tesla.Adapter.Hackney
Then if I run a fairly simple request from iex, it times out:
iex(1)> Tesla.get("https://login.microsoftonline.com")
{:error, :timeout}
On the same host, I have another application with Tesla installed. I can run the same request without any issue.
Any idea how I could troubleshoot that?
(it’s running on Elixir 1.1.4 / Erlang 25.0)
1 Like
Likely the second app has a configuration for Tesla (or the underlying HTTP client library) that has a bigger timeout?
1 Like
There is something going wrong with the request itself: it times out after 5 or 10seconds, whereas on the other app the request succeeds in about 50ms
Maybe the server doesn’t like the user agent?
Yes maybe, will check that, but I didn’t tweak Tesla user agent in any of my app.
and the server I’m connecting to is the MS Oauth endpoint for Azure APIs (so nothing unusual)
Are you running both apps on the same machine?
If so, you are fully equipped to start inspecting the actual requests that go out (insert IO.inspect
or dbg
along the way) and you will figure it out. I can’t help you off-hand except these 2-3 quick things I would first look into.
1 Like
Two weeks later, I finally found the issue was Erlang version
opened 05:41AM - 09 Jun 22 UTC
closed 09:32AM - 09 Jun 22 UTC
team:PS
bug
**Describe the bug**
SSL timeouts connecting to certain hosts, namely `https://… login.microsoftonline.com` and `https://login.microsoft.com`
**To Reproduce**
1. Issue a get request using `hackney` or any other HTTP client to `https://login.microsoftonline.com`
**Expected behavior**
SSL connects successfully
**Affected versions**
25.0
**Additional context**
[Here's a barebones Mix project to highlight the issue](https://github.com/firezone/otp_25_ssl_bug) (sorry, I know it's not pure Erlang, but this issue seems to arise from OTP 25's SSL implementation as this bug is not present on OTP <= 24).
Testing conduction on an M1 mac (OpenSSL 3.0.3) and x64_64 linux host (OpenSSL 1.1.1f) both exhibiting the same issue.
Unsure how widespread the issue is -- preliminary testing only shows the two Microsoft URLs triggering the problem.
1 Like