RoyalMist

RoyalMist

How to change request timeout of Phoenix Endpoint with Bandit

Hello :slight_smile:

I got a stupid question I cannot find a way to increase the default timeout of 60_000 microseconds.
A client of mine is currently uploading zips to my app and the size is currently too big for this default timeout.

After lokking at Bandit docs I put it like this:

config :bazzile, BazzileWeb.Endpoint,
    secret_key_base: secret_key_base,
    url: [host: host, scheme: "https", port: 443],
    check_origin: false,
    http: [
      ip: {0, 0, 0, 0, 0, 0, 0, 0},
      port: port,
      options: [
        read_timeout: 300_000
      ]
    ]

But it is not working. Any clue on this ?

Thanks a lot :slight_smile:

Most Liked

mtrudel

mtrudel

Creator of Bandit

Sorry for the late reply!

The option to set body read timeouts is actually set as part of the Plug.Conn.read_body/2 call; see Plug.Conn — Plug v1.20.2 (specifically the read_timeout parameter) for details.

The read_timeout parameter as you’re passing it above (note that the options field has recently changed to thousand_island_options) is concerned with read timeouts for operations not otherwise set via the Plug.Conn API, such as header reading, HTTP/2 frame reading, etc.

PJUllrich

PJUllrich

Author of Building Table Views with Phoenix LiveView

I just configured it like this:

  config :my_app, MyAppWeb.Endpoint,
    url: [host: host, port: 443, scheme: "https"],
    http: [
      ip: {0, 0, 0, 0, 0, 0, 0, 0},
      port: port,
      thousand_island_options: [
        # Wait 60s for the client to complete the connection/upload before forcibly shutting it (Default: 15s)
        shutdown_timeout: 60_000
      ]
    ],
    secret_key_base: secret_key_base

Where Next?

Popular in Questions Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
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
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

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
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31494 112
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
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement