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
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
Hi all,
I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
I’m very new to Elixir, so sorry if this is a silly question:
I am wondering what happens to the mailbox of a process when the machine i...
New
How do I tell Hologram not to escape HTML when substituting into templates?
{Textile.render(@product.long_description)}
escapes the HTM...
New
Background
When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error:
* assembling mark...
New
Hi,
we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
Hi everyone :waving_hand:
I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
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
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 just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
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
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #elixirconf-us
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #elixirconf-eu
- #processes
- #security
- #api
- #forms
- #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