JDanielMartinez

JDanielMartinez

** (RuntimeError) could not lookup Ecto repo Repo because it was not started or it does not exist

Hi! May someone helps me, please!

I have two apps into an umbrella project: the first one is Database, which manages queries, and the secon one is an app, which uses some functions from the Database app to check information from the database. I am getting the next error when trying to run tests for functions in the second one which uses functions from the Database app:

** (RuntimeError) could not lookup Ecto repo Repo because it was not started or it does not exist

and this is the setup that I have for my tests:

  setup do
    :ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo)
  end

Most Liked

dogweather

dogweather

We just solved this problem. In our case, the test database had unexpected data. (!!) It might have had a slightly different schema than expected.

The fix was to recreate the test database with MIX_ENV=test mix ecto.reset.

It was a frustrating experience.

dalerka

dalerka

I’m also experiencing this issue. and @dogweather’s solution didn’t help.
Can anyone please suggest how to fix this?
This is really weird.

My app is simple (non-umbrella) with the following relevant deps:
{:phoenix, “~> 1.5.1”},
{:phoenix_ecto, “~> 4.1”},
{:ecto_sql, “~> 3.4”},
{:postgrex, “>= 0.0.0”},

BTW, my OS :
Linux 4.15.0-1-amd64 #1 SMP Debian 4.15.4-1~mx17+1 (2018-02-23) x86_64 GNU/Linux

Distributor ID: MX
Description: MX 18.3 Continuum
Release: 18.3
Codename: Continuum

UPDATE: tried the following, but issue persists, preventing me from further development of my app:

mix deps.update --all   # Ok
mix ecto.reset    # Fail: this keeps throwing the same error (the current topic)

Also dropped both my_dev and my_test DBs via psql then ran mix ecto.reset to no success.

vrod

vrod

This comes up sometimes depending on how you are using your repo. Sometimes you just need to start it, e.g.

MyApp.Repo.start_link()

Where Next?

Popular in Questions Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
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
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
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
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
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
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 48475 226
New
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
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
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New

We're in Beta

About us Mission Statement