Aktaeon

Aktaeon

Starting hackney so I can use it in runtime.exs

Hello, I would like to do a http request to Vault during runtime.exs . I am using Httpoison, but same result for Tesla, everything works fine to get the Vault key when using the module directly in an iex session, but when putting the code in runtime.exs I get the following error:

** (ArgumentError) errors were found at the given arguments:

  • 1st argument: the table identifier does not refer to an existing ETS table
    (stdlib 3.16.1) :ets.lookup_element(:hackney_config, :mod_metrics, 2)

From my understanding the hackney process needs to be started which is done automatically as it is one of deps, however that process only kicks in after runtime.exs is processed. My question is how do I start hackney correctly before runtime.exs ? I tried adding to extra_applications: in mix.exs but that does not seem to do the trick.

Most Liked

LostKobrakai

LostKobrakai

For that usecase you should consider a custom config provider:

harmon25

harmon25

Config providers are probably a better approach - but I think I have solved this by simple running Application.ensure_all_started/2 or possibly Application.ensure_started/2 earlier in the runtime.exs file.

Like this:
:ok = Application.ensure_all_started(:hackney)

Application — Elixir v1.12.3 (hexdocs.pm)

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
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
hariharasudhan94
I would like to know what is the best IDE for elixir development?
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
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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement