pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database.
Dependencies
{:comeonin, "~> 5.1"},
{:postgrex, "~> 0.14.1"},
{:ecto_sql, "~> 3.0"},
Repo
defmodule AccountService.Repo do
use Ecto.Repo,
otp_app: :account_service,
adapter: Ecto.Adapters.Postgres
end
Config
config :account_service, AccountService.Repo,
database: "worksolvr",
username: "postgres",
password: "REDACTED",
hostname: "localhost"
When i attempt to run mix ecto.migrate I receive:
[error] GenServer #PID<0.202.0> terminating
** (RuntimeError) connect raised KeyError exception: key :database not found.The exception details are hidden, as they may contain sensitive data such as database credentials. You may set :show_sensitive_data_on_connection_error to true if you wish to see all of the details
(elixir) lib/keyword.ex:389: Keyword.fetch!/2
(postgrex) lib/postgrex/protocol.ex:90: Postgrex.Protocol.connect/1
(db_connection) lib/db_connection/connection.ex:66: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
Thanks,
Peter
Trending in Questions
I’m aware of 2 such projects, are there others?
git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hi everyone.
My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
How Can I Optimise Compile Time Dependencies
I have been building an elixir application for about 2 years now. Many modules and files ha...
New
Hi,
we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
Other Trending Topics
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #performance











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
scottming
Did you create the db?
schaary
I miss the line
in your
config/config.exfile.Sanjer
Ensure the below and give it a re-try.
STEP 1. Define the dependencies required, mix.exs
STEP 2. Get the dependencies defined above
mix deps.getSTEP 3. Configure the Repo the application
config :helloapp, ecto_repos: [HelloApp.Repo]Note: the :helloapp must be match the app name defined in the application.ex file. In my case I have created the application using the below command
mix new hello app --app hello app --supSTEP 4. Configure the the Repo itself defined above
STEP 4. Define the HelloApp.Repo module in repo.ex file in /lib/{app name}
STEP 5. Now, lets create the database
mix ecto.createThe output should be as below.
Compiling 1 file (.ex)
Generated helloapp app
The database for HelloApp.Repo has already been created.
Hope it helps somebody.
tenzil
Hi folks, I facing the following error with heroku. in local the app connects with db and running fine, only with heroku its throwing the following error.
I am unable to execute mix ecto.setup,
i do have another app running fine in heroku, i followed the same setups but its not connecting for the new app
Anyone facing the same error, I even updated my postgrex in mix
dimitarvp
Post your entire
prod.exs(without the secrets)? Seems like a straightforward case of not having the:databaseconfiguration key in the file.tenzil
Heroku uses url which has database, host, user, and password. which worked fine in elixir 1.8 phoenix app but not in 1.9 phoenix app
dimitarvp
Are you sure your app’s atom name is
:MyAppand not:myapp?Can you also show your
MyAppRepo.exfile?tenzil
yeah its “config :myapp, MyApp.Repo”
its a typo.
This works fine in dev env (local ), but it gets deployed in heroku as well, but just not getting connected with database.
dimitarvp
I am assuming you have a
DATABASE_URLenvironment variable in your Heroku configuration?tenzil
yes, i do have. dont know why its not connecting