baruh

baruh

Livebook timeout with httpoison

I have very simple livebook with setup like this

Mix.install([
  {:httpoison, "~> 2.0.0"},
  {:jason, "~> 1.4.0"}
])

and some code

url = "https://example.com/generate/image"
timeout = 60000
headers = [{"Content-Type", "application/json"}]
resp = HTTPoison.post!(url, payload, headers, timeout: timeout, recv_timout: timeout)

However, it seems like my requests timeout still after 5s instead of after 60s.

** (HTTPoison.Error) :timeout
    (httpoison 2.0.0) lib/httpoison.ex:261: HTTPoison.request!/5

I suppose the problem is that I did not set the timeout for hackney.
Any ideas how I can do that?
NOTE: I am so new to the livebook coding, that I could not even find how to stop the session and start from the beginning.

Marked As Solved

jerdew

jerdew

It sounds like you might be right. Perhaps this github issue helps? Timeout bigger than 5s does not work with hackney adapter · Issue #151 · elixir-tesla/tesla · GitHub

I also recommend trying Req — req v0.6.2 instead of httpoison, especially in a livebook setting for its simplicity.

Last Post!

baruh

baruh

Thank you! I will try Req, thankfully this is very easy in a livebook.

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement