Tesla timeout on a dummy request

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 :slight_smile:

1 Like