henriquesati

henriquesati

Getting: (exit) shutdown: failed to start child: DBConnection.ConnectionPool ** (EXIT) exited in: GenServer.call(DBConnection.Watcher

Why I’m getting this error when trying to dynamically connect to repo?
insert.ex file

{:ok, _} = Application.ensure_all_started(:req)
    ct = %{
      chain: "ethereum",
      coin: "ETH",
      transaction_value: 12.345,
      transaction_charged: 1.234,
      ref: "test_ref",
      payload: "test_payload",
      public: "test_public",
      private: "test_private",
      status: false
    }
    
    default_dynamic_repo = MyApp.Repo.get_dynamic_repo()

    {:ok, repo} =
      MyApp.Repo.start_link(
        name: :gatinhos,
        hostname: "localhost",
        username: "pedri",
        password: "1234",
        pool_size: 1
      )
    
    try do
      MyApp.Repo.put_dynamic_repo(repo)
      MyApp.Repo.all(Post)
    after
      MyApp.Repo.put_dynamic_repo(default_dynamic_repo)
      Supervisor.stop(repo)
    end
  
  

application.ex

defmodule TestesPay.Application do

  use Application

  def start(_type, _args) do
    Dotenv.load()
    children = [
      MyApp.Repo,
    ]

    opts = [strategy: :one_for_one, name: Myapp.Supervisor]  # Add a space after name:
    Supervisor.start_link(children, opts)
  end
end

mix.exs file`defmodule TestesPay.MixProject do

  use Mix.Project

  def project do
    [
      app: :testes_pay,
      version: "0.1.0",
      elixir: "~> 1.16",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger, :postgrex],
      mod: {TestesPay.Application, []}
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:req, "~> 0.5.0"},
      {:ecto_sql, "~> 3.6"},
      {:postgrex, "~> 0.19.1"},
      {:rustler, "~> 0.34.0"},
      {:dotenv, "~> 3.0"},
      {:decimal, "~> 2.0"}
      # {:dep_from_hexpm, "~> 0.3.0"},
      # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
    ]
  end
end
** (exit) shutdown: failed to start child: DBConnection.ConnectionPool ** (EXIT) exited in: GenServer.call(DBConnection.Watcher, {:watch, DBConnection.ConnectionPool.Supervisor, {DBConnection.ConnectionPool.Pool, {#PID<0.215.0>, #Reference<0.226797208

I dont need to load it dynamic, but I couldnt also connect via the default connection in the Ecto docs via config.,exs
i’m able to give cli commands suach as Ecto migrate etc and it connects to db make changes, but querying it by code isnt working

Where Next?

Popular in Questions Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
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 record...
New
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
wernerlaude
In AR this is so simple @articles = current_user.articles How to do in Ecto? def index(conn, _params) do current_user = conn.assig...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
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

We're in Beta

About us Mission Statement